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>
<div v-if="isShow">
<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"/>
</div>
<el-dropdown-menu slot="dropdown" class="dropdown-menu-class">
<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}}
</el-dropdown-item>
</el-dropdown-menu>
@ -17,19 +17,6 @@
<script>
export default {
name: "ShowMoreBtn",
data() {
return {}
},
methods: {
click() {
// console.log("click");
},
clickStop(btn) {
if (btn.stop instanceof Function) {
btn.stop();
}
}
},
props: {
isShow: {
type: Boolean,
@ -38,6 +25,13 @@
buttons: Array,
row: Object,
size: Number
},
methods: {
click(btn) {
if (btn.handleClick instanceof Function) {
btn.handleClick();
}
}
}
}
</script>

View File

@ -191,11 +191,11 @@
showMore: false,
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);
this.initTableData();
},
handleClickStop() {
handleBatchEdit() {
this.$refs.batchEdit.open();
},
handleMove() {
handleBatchMove() {
this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id));
}
}