tianheng-ui 0.0.14 → 0.0.18

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.14",
4
+ "version": "0.0.18",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -4,20 +4,20 @@
4
4
  <el-button
5
5
  v-if="item.act_type === 'edit'"
6
6
  :key="index"
7
- :style="{ color: item.btn_disabled ? '' : item.btn_color }"
7
+ :style="{ color: btnDisabled(item) ? '' : item.btn_color }"
8
8
  :type="item.btn_type"
9
9
  :icon="item.btn_icon"
10
- :disabled="item.btn_disabled"
10
+ :disabled="btnDisabled(item)"
11
11
  @click="doEdit(item)"
12
12
  >{{ item.btn_name }}</el-button
13
13
  >
14
14
  <el-button
15
15
  v-else-if="item.act_type === 'look'"
16
16
  :key="index"
17
- :style="{ color: item.btn_disabled ? '' : item.btn_color }"
17
+ :style="{ color: btnDisabled(item) ? '' : item.btn_color }"
18
18
  :type="item.btn_type"
19
19
  :icon="item.btn_icon"
20
- :disabled="item.btn_disabled"
20
+ :disabled="btnDisabled(item)"
21
21
  @click="doLook(item)"
22
22
  >{{ item.btn_name }}</el-button
23
23
  >
@@ -44,9 +44,9 @@
44
44
  >
45
45
  </div>
46
46
  <el-button
47
- :style="{ color: item.btn_disabled ? '' : item.btn_color }"
47
+ :style="{ color: btnDisabled(item) ? '' : item.btn_color }"
48
48
  slot="reference"
49
- :disabled="loadingDel || item.btn_disabled"
49
+ :disabled="loadingDel || btnDisabled(item)"
50
50
  :type="item.btn_type"
51
51
  :icon="item.btn_icon"
52
52
  @click="toDelete"
@@ -59,7 +59,7 @@
59
59
  :style="{ color: item.btn_color }"
60
60
  :type="item.btn_type"
61
61
  :icon="item.btn_icon"
62
- :disabled="item.btn_disabled"
62
+ :disabled="btnDisabled(item)"
63
63
  @click="doEval(item)"
64
64
  >{{ item.btn_name }}</el-button
65
65
  >
@@ -77,6 +77,9 @@ export default {
77
77
  return [];
78
78
  }
79
79
  },
80
+ scope: {
81
+ type: Object | String,
82
+ },
80
83
  permission: {
81
84
  type: Object,
82
85
  required: false
@@ -92,6 +95,18 @@ export default {
92
95
  loadingDel: false
93
96
  };
94
97
  },
98
+ computed: {
99
+ btnDisabled() {
100
+ return (item) => {
101
+ if (item.btn_disabled instanceof Boolean) {
102
+ return item.btn_disabled
103
+ }
104
+ if (item.btn_disabled instanceof Function) {
105
+ return item.btn_disabled(this.scope);
106
+ }
107
+ };
108
+ },
109
+ },
95
110
  methods: {
96
111
  toDelete() {
97
112
  this.pop = true;
@@ -1,24 +1,8 @@
1
1
  import Table from "./index.vue";
2
+
2
3
  /* istanbul ignore next */
3
4
  Table.install = function(Vue) {
4
5
  Vue.component(Table.name, Table);
5
6
  };
6
7
 
7
- import TableAction from "./action.vue";
8
- /* istanbul ignore next */
9
- TableAction.install = function(Vue) {
10
- Vue.component(TableAction.name, TableAction);
11
- };
12
-
13
- import TableTools from "./tools.vue";
14
- /* istanbul ignore next */
15
- TableTools.install = function(Vue) {
16
- Vue.component(TableTools.name, TableTools);
17
- };
18
-
19
- import TableSearch from "./search.vue";
20
- /* istanbul ignore next */
21
- TableSearch.install = function(Vue) {
22
- Vue.component(TableSearch.name, TableSearch);
23
- };
24
- export default { Table, TableAction, TableTools, TableSearch };
8
+ export default Table;
@@ -3,6 +3,7 @@
3
3
  <el-table
4
4
  ref="th_table"
5
5
  v-loading="loading"
6
+ :height="height"
6
7
  :data="data"
7
8
  :row-key="rowKey"
8
9
  :stripe="stripe"
@@ -150,12 +151,7 @@ export default {
150
151
  return false;
151
152
  }
152
153
  },
153
- height: {
154
- type: String,
155
- default: () => {
156
- return "";
157
- }
158
- },
154
+ height: String | Number,
159
155
  rowKey: {
160
156
  type: String,
161
157
  default: () => {