-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathMultiSelect.vue
More file actions
64 lines (58 loc) · 1.34 KB
/
MultiSelect.vue
File metadata and controls
64 lines (58 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<template>
<el-select
class="m-2"
multiple
filterable
clearable
v-bind="$attrs"
v-model="_modelValue"
>
<el-option
v-for="(item, index) in option_list"
:key="index"
:label="label(item)"
:value="item[valueField]"
>
</el-option>
</el-select>
</template>
<script setup lang="ts">
import type { FormField } from '@/components/dynamics-form/type'
import { computed, ref } from 'vue'
import _ from 'lodash'
const rowTemp = ref<any>()
const props = defineProps<{
modelValue?: Array<any>
formValue?: any
formfieldList?: Array<FormField>
field: string
otherParams: any
formField: FormField
view?: boolean
}>()
const emit = defineEmits(['update:modelValue', 'change'])
const _modelValue = computed({
get() {
if (props.modelValue) {
return props.modelValue
}
return []
},
set($event) {
emit('update:modelValue', $event)
}
})
const textField = computed(() => {
return props.formField.text_field ? props.formField.text_field : 'key'
})
const valueField = computed(() => {
return props.formField.value_field ? props.formField.value_field : 'value'
})
const option_list = computed(() => {
return props.formField.option_list ? props.formField.option_list : []
})
const label = (option: any) => {
return option[textField.value]
}
</script>
<style lang="scss"></style>