refactor: 优化变量命名

This commit is contained in:
shiziyuan9527 2020-08-06 15:22:23 +08:00
parent e5c4885d3f
commit 4a20e5ccad
2 changed files with 14 additions and 20 deletions

View File

@ -1,12 +1,12 @@
<template> <template>
<div v-if="isShow"> <div v-if="isShow">
<el-dropdown placement="bottom" trigger="click" size="medium"> <el-dropdown placement="bottom" trigger="click" size="medium">
<div @click.stop="click" class="show-more-btn"> <div @click.stop class="show-more-btn">
<i class="el-icon-more ms-icon-more"/> <i class="el-icon-more ms-icon-more"/>
</div> </div>
<el-dropdown-menu slot="dropdown" class="dropdown-menu-class"> <el-dropdown-menu slot="dropdown" class="dropdown-menu-class">
<div class="show-more-btn-title">{{$t('test_track.case.batch_handle', [size])}}</div> <div class="show-more-btn-title">{{$t('test_track.case.batch_handle', [size])}}</div>
<el-dropdown-item v-for="(btn,index) in buttons" :key="index" @click.native.stop="clickStop(btn)"> <el-dropdown-item v-for="(btn,index) in buttons" :key="index" @click.native.stop="click(btn)">
{{btn.name}} {{btn.name}}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
@ -17,19 +17,6 @@
<script> <script>
export default { export default {
name: "ShowMoreBtn", name: "ShowMoreBtn",
data() {
return {}
},
methods: {
click() {
// console.log("click");
},
clickStop(btn) {
if (btn.stop instanceof Function) {
btn.stop();
}
}
},
props: { props: {
isShow: { isShow: {
type: Boolean, type: Boolean,
@ -38,6 +25,13 @@
buttons: Array, buttons: Array,
row: Object, row: Object,
size: Number size: Number
},
methods: {
click(btn) {
if (btn.handleClick instanceof Function) {
btn.handleClick();
}
}
} }
} }
</script> </script>

View File

@ -191,11 +191,11 @@
showMore: false, showMore: false,
buttons: [ buttons: [
{ {
name: '批量编辑用例', stop: this.handleClickStop name: '批量编辑用例', handleClick: this.handleBatchEdit
}, { }, {
name: '批量移动用例', stop: this.handleMove name: '批量移动用例', handleClick: this.handleBatchMove
}, { }, {
name: '批量删除用例', stop: this.handleDeleteBatch name: '批量删除用例', handleClick: this.handleDeleteBatch
} }
] ]
} }
@ -428,10 +428,10 @@
_sort(column, this.condition); _sort(column, this.condition);
this.initTableData(); this.initTableData();
}, },
handleClickStop() { handleBatchEdit() {
this.$refs.batchEdit.open(); this.$refs.batchEdit.open();
}, },
handleMove() { handleBatchMove() {
this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id)); this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id));
} }
} }