Skip to content

wevu / index / defineModel

函数: defineModel()

defineModel<T>(name?, options?): Ref<T | undefined>

定义于: packages/wevu/src/macros.ts:273

defineModel 声明 v-model 绑定(weapp 变体)。 支持默认字段与自定义字段名。

类型参数

T

T = any

参数

name?

string

options?

Record<string, any>

返回

Ref<T | undefined>

示例

ts
const modelValue = defineModel<string>()
const checked = defineModel<boolean>('checked')
const count = defineModel<number>('count', { default: 0 })

Released under the MIT License.