@kaiyinchem/ky-uniui 1.0.11 → 1.0.12
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/components/ky-picker.vue +19 -11
- package/package.json +1 -1
package/components/ky-picker.vue
CHANGED
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
|
|
25
25
|
<script>
|
|
26
26
|
export default {
|
|
27
|
-
emits: ['update:value', 'change'],
|
|
27
|
+
emits: ['update:value', 'update:label', 'change'],
|
|
28
28
|
props: {
|
|
29
|
-
/**
|
|
30
|
-
* 回显对象
|
|
31
|
-
*/
|
|
32
29
|
value: {
|
|
33
30
|
type: [Object, String, Number, Array],
|
|
34
31
|
},
|
|
32
|
+
label: {
|
|
33
|
+
type: [Object, String, Number, Array],
|
|
34
|
+
},
|
|
35
35
|
/**
|
|
36
36
|
* 格式,[{ name: 'xx': id: 'xxx' }]
|
|
37
37
|
*/
|
|
@@ -97,10 +97,14 @@
|
|
|
97
97
|
this.index = index
|
|
98
98
|
currVal.index = index
|
|
99
99
|
this.$emit('update:value', this.checked)
|
|
100
|
+
this.$emit('update:label', this.names[index])
|
|
100
101
|
this.$emit('change', currVal)
|
|
101
102
|
},
|
|
102
103
|
mapVal(v) {
|
|
103
104
|
if (typeof v === 'undefined') {
|
|
105
|
+
this.index = 0
|
|
106
|
+
this.multiIndex = [0, 0]
|
|
107
|
+
this.checked = ''
|
|
104
108
|
return
|
|
105
109
|
}
|
|
106
110
|
this.$nextTick(function() {
|
|
@@ -115,9 +119,6 @@
|
|
|
115
119
|
},
|
|
116
120
|
mapList(v) {
|
|
117
121
|
if (typeof v === 'undefined') {
|
|
118
|
-
this.index = 0
|
|
119
|
-
this.multiIndex = [0, 0]
|
|
120
|
-
this.checked = ''
|
|
121
122
|
return
|
|
122
123
|
}
|
|
123
124
|
if (this.mode === 'multiSelector') {
|
|
@@ -199,13 +200,20 @@
|
|
|
199
200
|
},
|
|
200
201
|
|
|
201
202
|
// 多列完成的时候触发
|
|
202
|
-
onMultichange(val, noEmit) {
|
|
203
|
+
onMultichange(val, noEmit) {
|
|
204
|
+
const data1 = this.names[0][val[0]]
|
|
205
|
+
const data2 = this.names[1][val[1]]
|
|
206
|
+
const emitValue = [data1[this.valueName], data2[this.valueName]]
|
|
207
|
+
const emitName = [data1[this.keyName], data2[this.keyName]]
|
|
203
208
|
this.checked = {
|
|
204
209
|
index: val,
|
|
205
|
-
data: [
|
|
206
|
-
}
|
|
210
|
+
data: [data1, data2]
|
|
211
|
+
}
|
|
212
|
+
console.log(emitValue, emitName)
|
|
207
213
|
if (!noEmit) {
|
|
208
|
-
this.$emit('update:value',
|
|
214
|
+
this.$emit('update:value', emitValue)
|
|
215
|
+
this.$emit('update:label', emitName)
|
|
216
|
+
this.$emit('change', this.checked)
|
|
209
217
|
}
|
|
210
218
|
}
|
|
211
219
|
}
|