tianheng-ui 0.0.32 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.0.32",
4
+ "version": "0.0.33",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -1,42 +1,23 @@
1
1
  <template>
2
2
  <div class="th-table-action" @click.stop>
3
3
  <template v-for="(item, index) in actions">
4
- <el-button
5
- v-if="item.act === 'edit'"
6
- :key="index"
7
- :style="item.style"
8
- :type="item.type"
9
- :icon="item.icon"
10
- :disabled="btnDisabled(item)"
11
- @click="doEdit(item)"
12
- >{{ item.name }}</el-button
13
- >
14
- <el-button
15
- v-else-if="item.act === 'look'"
16
- :key="index"
17
- :style="item.style"
18
- :type="item.type"
19
- :icon="item.icon"
20
- :disabled="btnDisabled(item)"
21
- @click="doLook(item)"
22
- >{{ item.name }}</el-button
23
- >
24
4
  <el-popover
25
- class="action-popover"
26
- v-else-if="item.act === 'delete'"
5
+ v-if="item.act === 'delete'"
27
6
  :key="index"
28
7
  v-model="pop"
29
8
  placement="top"
30
- title=""
31
9
  width="180"
32
10
  trigger="manual"
33
11
  >
34
12
  <p>{{ item.delmsg || msg }}</p>
35
13
  <div style="text-align: right; margin: 0">
36
- <el-button type="text" :disabled="loadingDel" @click="doCancel"
14
+ <el-button type="text" :disabled="loadingDel" @click="handleCancel"
37
15
  >取消</el-button
38
16
  >
39
- <el-button type="text" :loading="loadingDel" @click="doDelete(item)"
17
+ <el-button
18
+ type="text"
19
+ :loading="loadingDel"
20
+ @click="handleDelete(item)"
40
21
  >确定</el-button
41
22
  >
42
23
  </div>
@@ -51,14 +32,14 @@
51
32
  >
52
33
  </el-popover>
53
34
  <el-dropdown
54
- v-else-if="item.act === 'more'"
35
+ v-if="item.act === 'more'"
55
36
  :key="index"
56
37
  :trigger="item.trigger || 'click'"
57
38
  :placement="item.placement || 'bottom-end'"
58
39
  :disabled="btnDisabled(item)"
59
40
  @command="
60
41
  value => {
61
- doMore(value, index, item);
42
+ handleMore(value, index, item);
62
43
  }
63
44
  "
64
45
  >
@@ -88,7 +69,7 @@
88
69
  :type="item.type"
89
70
  :icon="item.icon"
90
71
  :disabled="btnDisabled(item)"
91
- @click="doEval(item)"
72
+ @click="handleClick(item)"
92
73
  >{{ item.name }}</el-button
93
74
  >
94
75
  </template>
@@ -136,34 +117,25 @@ export default {
136
117
  }
137
118
  },
138
119
  methods: {
139
- toDelete() {
140
- this.pop = true;
141
- },
142
- doCancel() {
120
+ handleCancel() {
121
+ this.loadingDel = false;
143
122
  this.pop = false;
144
123
  },
145
- doEval(item) {
146
- this.$emit("on-eval", item);
147
- },
148
- doEdit(item) {
149
- this.$emit("on-edit", item);
150
- },
151
- doLook(item) {
152
- this.$emit("on-look", item);
124
+ handleClick(item) {
125
+ this.$emit("on-click", item);
153
126
  },
154
- doDelete(item) {
127
+ handleDelete(item) {
155
128
  this.loadingDel = true;
156
129
  const callback = bool => {
157
- this.loadingDel = false;
158
- this.pop = !bool;
130
+ bool ? this.handleCancel() : (this.loadingDel = false);
159
131
  };
160
- this.$emit("on-delete", item, callback);
132
+ this.handleClick(item, callback);
161
133
  },
162
- doMore(value, index, item) {
134
+ handleMore(value, index, item) {
163
135
  for (let i = 0; i < item.children.length; i++) {
164
136
  const element = item.children[i];
165
137
  if (element.act === value) {
166
- this.$emit("on-more", element);
138
+ this.handleClick(element);
167
139
  break;
168
140
  }
169
141
  }