• Element Plus中的注意事项


    一、定义的变量不要和组件的名字一样,否则组件加载不出来,并且相关的警告很难定位错误。

    例如:
    你组件名el-table和你定义的变量名elTable,这时候就会浏览器控制台就会有警告:Component is missing template or render function,然后错误还很难定位。

    <template>  
      <el-table
          :data="tableData"
          style="width: 100%"
          @selection-change="handleSelectionChange"
      />
    template>
    <script setup>
    const elTable= {
      tableLabels: [
        {label: '表名称', property: 'tableName'},
        {label: '表描述', property: 'tableComment'},
        {label: '创建时间', property: 'createTimeFormat'},
        {label: '更新时间', property: 'updateTimeFormat'}
      ],
      tableData: []
    }
    script>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    二、单文件组件