fix: 修复一些问题
This commit is contained in:
parent
3e750a0943
commit
dcebda7ca6
@ -10,6 +10,13 @@ import {
|
|||||||
|
|
||||||
import { tagSelectOptions } from '#/components/dict';
|
import { tagSelectOptions } from '#/components/dict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要禁止透传
|
||||||
|
* 不禁止会有奇怪的bug 会绑定到selectType上
|
||||||
|
* TODO: 未知原因 有待研究
|
||||||
|
*/
|
||||||
|
defineOptions({ inheritAttrs: false });
|
||||||
|
|
||||||
defineEmits<{ deselect: [] }>();
|
defineEmits<{ deselect: [] }>();
|
||||||
|
|
||||||
const options = [
|
const options = [
|
||||||
@ -31,21 +38,22 @@ const selectType = defineModel('selectType', {
|
|||||||
type: String as PropType<SelectType>,
|
type: String as PropType<SelectType>,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* color必须为hex颜色或者undefined
|
||||||
|
*/
|
||||||
const color = defineModel('value', {
|
const color = defineModel('value', {
|
||||||
default: '',
|
default: undefined,
|
||||||
type: String,
|
type: String as PropType<string | undefined>,
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleSelectTypeChange(e: RadioChangeEvent) {
|
function handleSelectTypeChange(e: RadioChangeEvent) {
|
||||||
// 必须给默认hex颜色 不能为空字符串
|
// 必须给默认hex颜色 不能为空字符串
|
||||||
if (e.target.value === 'custom') {
|
color.value = e.target.value === 'custom' ? '#000000' : undefined;
|
||||||
color.value = '#FFFFFF';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex items-center gap-[6px]">
|
<div class="flex flex-1 items-center gap-[6px]">
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
v-model:value="selectType"
|
v-model:value="selectType"
|
||||||
:options="computedOptions"
|
:options="computedOptions"
|
||||||
@ -55,6 +63,7 @@ function handleSelectTypeChange(e: RadioChangeEvent) {
|
|||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
v-if="selectType === 'default'"
|
v-if="selectType === 'default'"
|
||||||
|
v-model:value="color"
|
||||||
:allow-clear="true"
|
:allow-clear="true"
|
||||||
:options="tagSelectOptions()"
|
:options="tagSelectOptions()"
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
|
Loading…
Reference in New Issue
Block a user