zydx-plus 1.17.74 → 1.17.76
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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span>
|
|
3
|
+
<input type="checkbox" :value="value" :checked="isChecked" @change="emitValue"/>
|
|
4
|
+
</span>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: "zydx-checkBox",
|
|
10
|
+
model: {
|
|
11
|
+
prop: "modelValue",
|
|
12
|
+
event: "update:modelValue"
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => []
|
|
18
|
+
},
|
|
19
|
+
value: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ''
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
isChecked () {
|
|
26
|
+
if (this.modelValue.includes(this.value)) {
|
|
27
|
+
return true
|
|
28
|
+
} else {
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
emitValue(e) {
|
|
35
|
+
let value = e.target.value
|
|
36
|
+
if (this.modelValue.includes(this.value)) {
|
|
37
|
+
this.modelValue.splice(this.modelValue.indexOf(value), 1)
|
|
38
|
+
} else {
|
|
39
|
+
this.modelValue.push(value)
|
|
40
|
+
}
|
|
41
|
+
this.$emit('update:modelValue', this.modelValue)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<style scoped>
|
|
48
|
+
</style>
|