|
@@ -5,7 +5,8 @@
|
|
|
{
|
|
{
|
|
|
'is-dark': isDark,
|
|
'is-dark': isDark,
|
|
|
'cl-select-trigger--disabled': isDisabled,
|
|
'cl-select-trigger--disabled': isDisabled,
|
|
|
- 'cl-select-trigger--focus': focus
|
|
|
|
|
|
|
+ 'cl-select-trigger--focus': focus,
|
|
|
|
|
+ 'cl-select-trigger--error': isError
|
|
|
},
|
|
},
|
|
|
pt.className
|
|
pt.className
|
|
|
]"
|
|
]"
|
|
@@ -62,7 +63,7 @@ import type { ClIconProps } from "../cl-icon/props";
|
|
|
import { isDark, parseClass, parsePt } from "@/cool";
|
|
import { isDark, parseClass, parsePt } from "@/cool";
|
|
|
import { t } from "@/locale";
|
|
import { t } from "@/locale";
|
|
|
import type { PassThroughProps } from "../../types";
|
|
import type { PassThroughProps } from "../../types";
|
|
|
-import { useForm } from "../../hooks";
|
|
|
|
|
|
|
+import { useForm, useFormItem } from "../../hooks";
|
|
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
|
name: "cl-select-trigger"
|
|
name: "cl-select-trigger"
|
|
@@ -104,8 +105,12 @@ const props = defineProps({
|
|
|
|
|
|
|
|
const emit = defineEmits(["open", "clear"]);
|
|
const emit = defineEmits(["open", "clear"]);
|
|
|
|
|
|
|
|
|
|
+// cl-form 上下文
|
|
|
const { disabled } = useForm();
|
|
const { disabled } = useForm();
|
|
|
|
|
|
|
|
|
|
+// cl-form-item 上下文
|
|
|
|
|
+const { isError } = useFormItem();
|
|
|
|
|
+
|
|
|
// 是否禁用
|
|
// 是否禁用
|
|
|
const isDisabled = computed(() => {
|
|
const isDisabled = computed(() => {
|
|
|
return disabled.value || props.disabled;
|
|
return disabled.value || props.disabled;
|
|
@@ -172,6 +177,10 @@ function open() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ &--error {
|
|
|
|
|
+ @apply border-red-500;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
&.is-dark {
|
|
&.is-dark {
|
|
|
@apply border-surface-700 bg-surface-800;
|
|
@apply border-surface-700 bg-surface-800;
|
|
|
|
|
|