✨ 字典组件新增分割字符串属性
This commit is contained in:
parent
09c57e6ac1
commit
dd87d9f305
@ -23,15 +23,21 @@ const props = defineProps({
|
||||
// 数据
|
||||
options: {
|
||||
type: Array,
|
||||
default: null,
|
||||
default: null
|
||||
},
|
||||
// 当前的值
|
||||
value: [Number, String, Array, Boolean],
|
||||
showValue: false,
|
||||
split: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
})
|
||||
|
||||
const values = computed(() => {
|
||||
if (props.value !== null && typeof props.value !== 'undefined') {
|
||||
if (props.split != null && props.split != '') {
|
||||
return props.value.split(props.split) ?? []
|
||||
} else if (props.value !== null && typeof props.value !== 'undefined') {
|
||||
return Array.isArray(props.value) ? props.value : [String(props.value)]
|
||||
} else {
|
||||
return []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user