feat(useForm): Add useForm

This commit is contained in:
陈凯龙
2022-01-07 17:38:24 +08:00
parent eb68f1d919
commit 357fc44e51
13 changed files with 489 additions and 91 deletions

View File

@@ -7,12 +7,20 @@ import { useConfigGlobal } from '@/hooks/web/useConfigGlobal'
import { zxcvbn } from '@zxcvbn-ts/core'
import type { ZxcvbnResult } from '@zxcvbn-ts/core'
defineProps({
const props = defineProps({
// 是否显示密码强度
strength: propTypes.bool.def(false),
modelValue: propTypes.string.def('')
})
watch(
() => props.modelValue,
(val: string) => {
if (val === unref(valueRef)) return
valueRef.value = val
}
)
const { configGlobal } = useConfigGlobal()
const emit = defineEmits(['update:modelValue'])
@@ -30,7 +38,7 @@ function changeTextType() {
}
// 输入框的值
const valueRef = ref('')
const valueRef = ref(props.modelValue)
// 监听
watch(