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