|
@@ -9,7 +9,7 @@
|
|
|
:clearable="isValue($attrs.clearable) ? $attrs.clearable : true"
|
|
|
:filterable="isValue($attrs.filterable) ? $attrs.filterable : true"
|
|
|
@change="handleChange"
|
|
|
- :title="optionsMapCpt.get(state.paramVal)?.[labelKey]"
|
|
|
+ :title="$attrs.multiple !== undefined ? state.paramVal?.map?.(v => optionsMapCpt.get(v)?.[labelKey]) : optionsMapCpt.get(state.paramVal)?.[labelKey]"
|
|
|
:disabled="isValue($attrs.disabled) ? $attrs.disabled : state.formView"
|
|
|
:teleported="isValue($attrs.teleported) ? $attrs.teleported : true"
|
|
|
>
|
|
@@ -46,7 +46,8 @@ const props = defineProps({
|
|
|
valueKey: { type: String, default: 'value' },
|
|
|
static: { default: false },
|
|
|
isLoading: { default: false },
|
|
|
- noWrap: { default: false }
|
|
|
+ noWrap: { default: false },
|
|
|
+ split: {default: null},
|
|
|
})
|
|
|
const attrs = (getCurrentInstance() as ComponentInternalInstance).attrs
|
|
|
const state = reactive({
|
|
@@ -55,12 +56,20 @@ const state = reactive({
|
|
|
elementLoadingBackground: inject('element-loading-background', null),
|
|
|
formView: inject('form-view', false),
|
|
|
})
|
|
|
-watch(() => state.paramVal, (n) => {
|
|
|
- emit('emitParam', n)
|
|
|
-})
|
|
|
-watch(() => props.param, (n) => {
|
|
|
- state.paramVal = n
|
|
|
+watch(() => state.paramVal, (n: any) => {
|
|
|
+ if (attrs.multiple !== undefined && props.split) {
|
|
|
+ emit('emitParam', n ? n.join(props.split) : n)
|
|
|
+ } else {
|
|
|
+ emit('emitParam', n)
|
|
|
+ }
|
|
|
})
|
|
|
+watch(() => props.param, (n: any) => {
|
|
|
+ if (attrs.multiple !== undefined && props.split) {
|
|
|
+ state.paramVal = n ? n.split(props.split) : n
|
|
|
+ } else {
|
|
|
+ state.paramVal = n
|
|
|
+ }
|
|
|
+}, {immediate: true})
|
|
|
watch(() => [props.options, props.static], () => {
|
|
|
state.loading = false
|
|
|
})
|