tianheng-ui 0.0.23 → 0.0.26

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.23",
4
+ "version": "0.0.26",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -8,7 +8,7 @@
8
8
  <slot v-if="$slots.description" name="description"></slot>
9
9
  <p v-else>{{ description }}</p>
10
10
  </div>
11
- <div v-if="$slots.default" class="th-empty-bottom">
11
+ <div v-if="$slots.default" class="th-empty-bottom">
12
12
  <slot></slot>
13
13
  </div>
14
14
  </div>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <div class="thTable-action" @click.stop>
3
3
  <template v-for="(item, index) in actions">
4
4
  <el-button
5
5
  v-if="item.act === 'edit'"
@@ -36,10 +36,7 @@
36
36
  <el-button type="text" :disabled="loadingDel" @click="doCancel"
37
37
  >取消</el-button
38
38
  >
39
- <el-button
40
- :loading="loadingDel"
41
- type="primary"
42
- @click="doDelete(item)"
39
+ <el-button type="text" :loading="loadingDel" @click="doDelete(item)"
43
40
  >确定</el-button
44
41
  >
45
42
  </div>
@@ -53,6 +50,37 @@
53
50
  >{{ item.name }}</el-button
54
51
  >
55
52
  </el-popover>
53
+ <el-dropdown
54
+ v-else-if="item.act === 'more'"
55
+ :key="index"
56
+ :trigger="item.trigger || 'click'"
57
+ :placement="item.placement || 'bottom-end'"
58
+ :disabled="btnDisabled(item)"
59
+ @command="
60
+ value => {
61
+ doMore(value, index, item);
62
+ }
63
+ "
64
+ >
65
+ <el-button
66
+ :style="item.style"
67
+ :disabled="loadingDel || btnDisabled(item)"
68
+ :type="item.type"
69
+ :icon="item.icon"
70
+ >{{ item.name }}</el-button
71
+ >
72
+ <el-dropdown-menu slot="dropdown">
73
+ <el-dropdown-item
74
+ v-for="(btnItem, btnIndex) in item.children"
75
+ :key="btnIndex"
76
+ :style="btnItem.style"
77
+ :command="btnItem.act"
78
+ :icon="btnItem.icon"
79
+ :disabled="btnItem.disabled"
80
+ >{{ btnItem.name }}</el-dropdown-item
81
+ >
82
+ </el-dropdown-menu>
83
+ </el-dropdown>
56
84
  <el-button
57
85
  v-else
58
86
  :key="index"
@@ -130,13 +158,33 @@ export default {
130
158
  this.pop = !bool;
131
159
  };
132
160
  this.$emit("on-delete", item, callback);
161
+ },
162
+ doMore(value, index, item) {
163
+ for (let i = 0; i < item.children.length; i++) {
164
+ const element = item.children[i];
165
+ if (element.act === value) {
166
+ this.$emit("on-more", element);
167
+ break;
168
+ }
169
+ }
133
170
  }
134
171
  }
135
172
  };
136
173
  </script>
137
174
 
138
175
  <style lang="less">
139
- .el-button + .action-popover {
140
- margin-left: 10px !important;
176
+ .thTable-action {
177
+ width: 100%;
178
+ display: flex;
179
+ align-items: center;
180
+ justify-content: space-around;
181
+
182
+ .el-button + .el-button {
183
+ margin-left: 0px;
184
+ }
141
185
  }
186
+
187
+ // .el-button + .action-popover {
188
+ // margin-left: 10px !important;
189
+ // }
142
190
  </style>
@@ -57,6 +57,7 @@
57
57
  :scope="scope"
58
58
  :option="item"
59
59
  />
60
+ <div v-else-if="item.alias">{{ scope.row[item.alias] }}</div>
60
61
  <div v-else>{{ scope.row[item.prop] }}</div>
61
62
  </template>
62
63
  </el-table-column>