xianniu-ui 0.3.9 → 0.3.11

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.9",
3
+ "version": "0.3.11",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -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,11 @@
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
- <el-radio v-model="radioSelected" :label="row[idKey]">&nbsp;</el-radio>
112
+ <el-radio
113
+ v-model="radioSelected"
114
+ :label="row[idKey]"
115
+ >&nbsp;</el-radio
116
+ >
112
117
  </template>
113
118
  </el-table-column>
114
119
  <el-table-column
@@ -196,12 +201,14 @@ export default {
196
201
  getList(val) {
197
202
  this.$emit("on-page", val);
198
203
  },
199
- singleElection(val) {
204
+ singleElection(val, column) {
200
205
  if (!this.radio) return;
201
206
  const { idKey } = this;
202
207
  this.radioSelected = val[idKey];
203
- const res = this.data.filter((item) => item[idKey] === val[idKey]);
204
- this.$emit("on-single", res);
208
+ const res = this.data.find(
209
+ (item, idx) => item[idKey] === val[idKey] && idx === val.rowIndex
210
+ );
211
+ this.$emit("on-single", res, column);
205
212
  },
206
213
  handleToolsItem(row, index) {
207
214
  this.$emit("on-tools", { row, index });
@@ -228,6 +235,9 @@ export default {
228
235
  doLayout() {
229
236
  this.$refs.table.doLayout();
230
237
  },
238
+ tableRowClassName({ row, rowIndex }) {
239
+ row.rowIndex = rowIndex;
240
+ },
231
241
  },
232
242
  };
233
243
  </script>