1- # defineModel
1+ # defineModels
22
33<StabilityLevel level =" stable " />
44
5- Declaring and mutate ` v-model ` props as the same as normal variable using the ` defineModel ` .
6-
7- For Vue >= 3.3, this feature will be turned off by default.
5+ Declaring and mutate ` v-model ` props as the same as normal variable using the ` defineModels ` .
86
97| Features | Supported |
108| :----------: | :----------------: |
@@ -17,7 +15,7 @@ For Vue >= 3.3, this feature will be turned off by default.
1715
1816``` ts
1917VueMacros ({
20- defineModel : {
18+ defineModels : {
2119 /**
2220 * Unified mode, only works for Vue 2
2321 *
@@ -34,7 +32,7 @@ Requires [`@vueuse/core`](https://www.npmjs.com/package/@vueuse/core), install i
3432
3533``` vue
3634<script setup lang="ts">
37- const { modelValue, count } = defineModel <{
35+ const { modelValue, count } = defineModels <{
3836 modelValue: string
3937 count: number
4038}>()
@@ -48,7 +46,7 @@ modelValue.value = 'newValue'
4846
4947``` vue
5048<script setup lang="ts">
51- const { modelValue } = defineModel ({
49+ const { modelValue } = defineModels ({
5250 modelValue: String,
5351})
5452</script>
@@ -60,7 +58,7 @@ const { modelValue } = defineModel({
6058
6159``` vue 3-6
6260<script setup lang="ts">
63- const { modelValue } = defineModel <{
61+ const { modelValue } = defineModels <{
6462 modelValue: ModelOptions<
6563 string,
6664 { defaultValue: 'something'; deep: true; passive: true }
@@ -81,7 +79,7 @@ Assignment expression is only supported in `<script setup>` block. In other word
8179
8280``` vue {7-9}
8381<script setup lang="ts">
84- let { modelValue, count } = $defineModel <{
82+ let { modelValue, count } = $defineModels <{
8583 modelValue: string
8684 count: number
8785}>()
@@ -122,10 +120,10 @@ emit('update:count', count + 1)
122120 " vueCompilerOptions" : {
123121 " target" : 3 , // or 2.7 for Vue 2
124122 " plugins" : [
125- " @vue-macros/volar/define-model "
123+ " @vue-macros/volar/define-models "
126124 // ...more feature
127125 ],
128- " defineModel " : {
126+ " defineModels " : {
129127 // Only works when target is 2.7.
130128 " unified" : true
131129 }
0 commit comments