使用vite创建的项目出现警告为解析函数名或方法

22.9.3在这前后两天创建的项目都发现了这样的问题,我重装了webstorm还是有这个问题出现,虽然报了警告但页面还是能正常显示

打开以前的项目就没有问题,能正常使用索引

img


<template>
  <div class="head">
    用户管理
  div>
  <div class="bold">
    <div>
      <el-button type="primary" @click="creator">新建el-button>
      <CreateOrEdit>CreateOrEdit>
      <el-input v-model="input" @change="onChange" placeholder="按关键字搜索" style="margin-left:10px ; width: 30%"
                size="small"/>
      <el-button type="primary" style="float: right">撤销el-button>
    div>
    <el-table
        ref="multipleTableRef"
        :data="tableData"
        @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55"/>
      <el-table-column property="name" label="姓名" width="80"/>
      <el-table-column property="age" label="年龄" width="80"/>
      <el-table-column property="sex" label="性别" width="80"/>
      <el-table-column property="phone" label="联系电话" width="120"/>
      <el-table-column property="address" label="详细地址" width="400" show-overflow-tooltip/>
      <el-table-column fixed="right" label="操作" width="135">
        <template #default="scope">
          <el-button type="primary" size="small" @click="editRow">编辑el-button>
          <el-button type="primary" size="small" @click.prevent="deleteRow(scope.$index)">删除el-button>
        template>
      el-table-column>
    el-table>
    <div>
      <el-button type="primary" style="margin-top:10px" @click.prevent="deleteBatchRow(multipleSelection)">删除选中
      el-button>
    div>
  div>

template>

<style lang="less">
.head {
  width: auto;
  padding: 40px;
  text-align: center;
  font-weight: bold;
  background-color: #ECECEC;
}

.bold {
  margin: 30px auto;
  width: 60%;
}
style>

<script lang="ts" setup>
import {ref} from 'vue'
import {ElTable} from 'element-plus'

interface User {
  id: number
  name: string
  age: number
  sex: string
  phone: string
  address: string
}

const multipleTableRef = ref<InstanceType<typeof ElTable>>()
const multipleSelection = ref<User[]>([])
const handleSelectionChange = (val: User[]) => {
  multipleSelection.value = val
  console.log(multipleSelection.value)
}
const creator = ()=>{

}
const input = ref('')
const onChange = (val: string) => {
  console.log(val)
}
const editRow = (val: User[]) => {

}
const deleteRow = (index: number) => {
  tableData.value.splice(index, 1)
}
const deleteBatchRow = (rows:any[]) => {
  if (rows){
    rows.forEach((row)=>{
      tableData.value.map((value,index)=>{
        if (value.id===row.id){
          tableData.value.splice(index,1)
        }
      })
    })
  }
}
const tableData = ref(
    [{
      id: 0,
      name: 'Tom',
      age: 19,
      sex: '男',
      phone: '13900000000',
      address: 'No. 189, Grove St, Los Angeles',
    },
      {
        id: 3,
        name: 'Tom',
        age: 19,
        sex: '男',
        phone: '13900000000',
        address: 'No. 189, Grove St, Los Angeles',
      }, {
      id: 2,
      name: 'Tom',
      age: 19,
      sex: '男',
      phone: '13900000000',
      address: 'No. 189, Grove St, Los Angeles',
    }])
script>

运行还是没有问题

img

猜测使vite更新了版本的原因,但详细情况不了解,望帮忙看看具体原因

  • 这篇文章:Vite的使用 也许有你想要的答案,你可以看看