添加 cl-form 组件

This commit is contained in:
icssoa
2025-08-06 10:18:17 +08:00
parent 49a57673ed
commit 42fd445248
25 changed files with 1008 additions and 52 deletions

View File

@@ -7,7 +7,7 @@
'is-dark': isDark,
'cl-textarea--border': border,
'cl-textarea--focus': isFocus,
'cl-textarea--disabled': disabled
'cl-textarea--disabled': isDisabled
}
]"
@tap="onTap"
@@ -16,7 +16,7 @@
class="cl-textarea__inner"
:class="[
{
'is-disabled': disabled,
'is-disabled': isDisabled,
'is-dark': isDark
},
pt.inner?.className
@@ -26,7 +26,7 @@
}"
:value="value"
:name="name"
:disabled="readonly ?? disabled"
:disabled="readonly ?? isDisabled"
:placeholder="placeholder"
:placeholder-class="`text-surface-400 ${placeholderClass}`"
:maxlength="maxlength"
@@ -63,6 +63,7 @@ import { parsePt, parseRpx } from "@/cool";
import type { PassThroughProps } from "../../types";
import { isDark } from "@/cool";
import { t } from "@/locale";
import { useForm } from "../../hooks";
defineOptions({
name: "cl-textarea"
@@ -221,6 +222,14 @@ const emit = defineEmits([
"keyboardheightchange"
]);
// cl-form 上下文
const { disabled } = useForm();
// 是否禁用
const isDisabled = computed(() => {
return disabled.value || props.disabled;
});
// 透传样式类型定义
type PassThrough = {
className?: string;
@@ -277,7 +286,7 @@ function onLineChange(e: UniTextareaLineChangeEvent) {
// 点击事件
function onTap() {
if (props.disabled) {
if (isDisabled.value) {
return;
}