xianniu-ui 0.3.8 → 0.3.9

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,6 +1,6 @@
1
1
  {
2
2
  "name": "xianniu-ui",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -108,7 +108,7 @@
108
108
  ></el-table-column>
109
109
  <el-table-column v-bind="$attrs" v-if="radio" width="40px" align="center">
110
110
  <template slot-scope="{ row }">
111
- <el-radio v-model="radioSelected" :label="row.id">&nbsp;</el-radio>
111
+ <el-radio v-model="radioSelected" :label="row[idKey]">&nbsp;</el-radio>
112
112
  </template>
113
113
  </el-table-column>
114
114
  <el-table-column
@@ -174,6 +174,10 @@ export default {
174
174
  showColumn: Boolean,
175
175
  expand: Boolean,
176
176
  isTools: Boolean,
177
+ idKey: {
178
+ type: String,
179
+ default: "id",
180
+ },
177
181
  },
178
182
  data() {
179
183
  return {
@@ -194,8 +198,9 @@ export default {
194
198
  },
195
199
  singleElection(val) {
196
200
  if (!this.radio) return;
197
- this.radioSelected = val.id;
198
- const res = this.data.filter((item) => item.id === val.id);
201
+ const { idKey } = this;
202
+ this.radioSelected = val[idKey];
203
+ const res = this.data.filter((item) => item[idKey] === val[idKey]);
199
204
  this.$emit("on-single", res);
200
205
  },
201
206
  handleToolsItem(row, index) {
@@ -214,9 +219,9 @@ export default {
214
219
  this.$refs.table.toggleRowSelection(row, status);
215
220
  },
216
221
  clearSelection() {
217
- if(this.radio){
218
- this.radioSelected = ''
219
- return
222
+ if (this.radio) {
223
+ this.radioSelected = "";
224
+ return;
220
225
  }
221
226
  this.$refs.table.clearSelection();
222
227
  },