@kaiyinchem/ky-uniui 1.0.10 → 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 -8
- 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() {
|
|
@@ -196,13 +200,20 @@
|
|
|
196
200
|
},
|
|
197
201
|
|
|
198
202
|
// 多列完成的时候触发
|
|
199
|
-
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]]
|
|
200
208
|
this.checked = {
|
|
201
209
|
index: val,
|
|
202
|
-
data: [
|
|
203
|
-
}
|
|
210
|
+
data: [data1, data2]
|
|
211
|
+
}
|
|
212
|
+
console.log(emitValue, emitName)
|
|
204
213
|
if (!noEmit) {
|
|
205
|
-
this.$emit('update:value',
|
|
214
|
+
this.$emit('update:value', emitValue)
|
|
215
|
+
this.$emit('update:label', emitName)
|
|
216
|
+
this.$emit('change', this.checked)
|
|
206
217
|
}
|
|
207
218
|
}
|
|
208
219
|
}
|