lrf402788946 4 years ago
parent
commit
8bcf27975e
1 changed files with 17 additions and 9 deletions
  1. 17 9
      components/data-table.vue

+ 17 - 9
components/data-table.vue

@@ -30,15 +30,22 @@
           <template v-slot="{ row, $index }">
             <template v-for="(item, index) in opera">
               <template v-if="display(item, row)">
-                <el-tooltip :key="index" effect="dark" :content="item.label" placement="bottom">
-                  <el-button
-                    :key="index"
-                    type="text"
-                    :icon="item.icon || ''"
-                    size="mini"
-                    @click="handleOpera(row, item.method, item.confirm, item.methodZh, item.label, $index)"
-                  ></el-button>
-                </el-tooltip>
+                <template v-if="item.icon">
+                  <el-tooltip :key="index" effect="dark" :content="item.label" placement="bottom">
+                    <el-button
+                      :key="index"
+                      type="text"
+                      :icon="item.icon || ''"
+                      size="mini"
+                      @click="handleOpera(row, item.method, item.confirm, item.methodZh, item.label, $index)"
+                    ></el-button>
+                  </el-tooltip>
+                </template>
+                <template v-else>
+                  <el-button :key="index" type="text" size="mini" @click="handleOpera(row, item.method, item.confirm, item.methodZh, item.label, $index)">
+                    {{ item.label }}
+                  </el-button>
+                </template>
               </template>
             </template>
           </template>
@@ -88,6 +95,7 @@ export default {
       }
     },
     handleOpera(data, method, confirm = false, methodZh, label, index) {
+      if (!method) return;
       let self = true;
       if (_.isFunction(methodZh)) {
         methodZh = methodZh(data);