xianniu-ui 0.3.8 → 0.3.10
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/lib/xianniu-ui.common.js +48 -58
- package/lib/xianniu-ui.umd.js +48 -58
- package/lib/xianniu-ui.umd.min.js +2 -2
- package/package.json +1 -1
- package/packages/table/main.vue +24 -8
package/package.json
CHANGED
package/packages/table/main.vue
CHANGED
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
:stripe="stripe"
|
|
98
98
|
@row-click="singleElection"
|
|
99
99
|
@selection-change="selectionChange"
|
|
100
|
+
:row-class-name="tableRowClassName"
|
|
100
101
|
:class="{ 'disabled-all-selection': radio }"
|
|
101
102
|
>
|
|
102
103
|
<el-table-column
|
|
@@ -108,7 +109,12 @@
|
|
|
108
109
|
></el-table-column>
|
|
109
110
|
<el-table-column v-bind="$attrs" v-if="radio" width="40px" align="center">
|
|
110
111
|
<template slot-scope="{ row }">
|
|
111
|
-
|
|
112
|
+
{{ row[idKey] }}
|
|
113
|
+
<el-radio
|
|
114
|
+
v-model="radioSelected"
|
|
115
|
+
:label="row[idKey]"
|
|
116
|
+
> </el-radio
|
|
117
|
+
>
|
|
112
118
|
</template>
|
|
113
119
|
</el-table-column>
|
|
114
120
|
<el-table-column
|
|
@@ -174,6 +180,10 @@ export default {
|
|
|
174
180
|
showColumn: Boolean,
|
|
175
181
|
expand: Boolean,
|
|
176
182
|
isTools: Boolean,
|
|
183
|
+
idKey: {
|
|
184
|
+
type: String,
|
|
185
|
+
default: "id",
|
|
186
|
+
},
|
|
177
187
|
},
|
|
178
188
|
data() {
|
|
179
189
|
return {
|
|
@@ -192,11 +202,14 @@ export default {
|
|
|
192
202
|
getList(val) {
|
|
193
203
|
this.$emit("on-page", val);
|
|
194
204
|
},
|
|
195
|
-
singleElection(val) {
|
|
205
|
+
singleElection(val, column) {
|
|
196
206
|
if (!this.radio) return;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
this
|
|
207
|
+
const { idKey } = this;
|
|
208
|
+
this.radioSelected = val[idKey];
|
|
209
|
+
const res = this.data.find(
|
|
210
|
+
(item, idx) => item[idKey] === val[idKey] && idx === val.rowIndex
|
|
211
|
+
);
|
|
212
|
+
this.$emit("on-single", res, column);
|
|
200
213
|
},
|
|
201
214
|
handleToolsItem(row, index) {
|
|
202
215
|
this.$emit("on-tools", { row, index });
|
|
@@ -214,15 +227,18 @@ export default {
|
|
|
214
227
|
this.$refs.table.toggleRowSelection(row, status);
|
|
215
228
|
},
|
|
216
229
|
clearSelection() {
|
|
217
|
-
if(this.radio){
|
|
218
|
-
this.radioSelected =
|
|
219
|
-
return
|
|
230
|
+
if (this.radio) {
|
|
231
|
+
this.radioSelected = "";
|
|
232
|
+
return;
|
|
220
233
|
}
|
|
221
234
|
this.$refs.table.clearSelection();
|
|
222
235
|
},
|
|
223
236
|
doLayout() {
|
|
224
237
|
this.$refs.table.doLayout();
|
|
225
238
|
},
|
|
239
|
+
tableRowClassName({ row, rowIndex }) {
|
|
240
|
+
row.rowIndex = rowIndex;
|
|
241
|
+
},
|
|
226
242
|
},
|
|
227
243
|
};
|
|
228
244
|
</script>
|