Skip to content

Commit 5d65f5b

Browse files
committed
refactor!(define-models): rename defineModel to defineModels
1 parent 14d7886 commit 5d65f5b

File tree

102 files changed

+181
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+181
-177
lines changed

.changeset/brave-dots-speak.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
'unplugin-vue-define-options': patch
55
'@vue-macros/named-template': patch
66
'@vue-macros/single-define': patch
7-
'@vue-macros/define-model': patch
7+
'@vue-macros/define-models': patch
88
---
99

1010
simplify import helper function

.changeset/metal-seahorses-drum.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'unplugin-vue-macros': major
3+
'@vue-macros/common': patch
4+
'@vue-macros/volar': patch
5+
'@vue-macros/nuxt': patch
6+
---
7+
8+
rename defineModel to defineModels

docs/.vitepress/locales/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export const sidebar = (lang: string): DefaultTheme.SidebarItem[] => {
7474
link: `${urlPrefix}/macros/define-slots`,
7575
},
7676
{
77-
text: 'defineModel',
78-
link: `${urlPrefix}/macros/define-model`,
77+
text: 'defineModels',
78+
link: `${urlPrefix}/macros/define-models`,
7979
},
8080
{
8181
text: 'shortEmits',

docs/guide/bundler-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ npm i -D @vue-macros/volar
136136
"vueCompilerOptions": {
137137
"plugins": [
138138
"@vue-macros/volar/define-options",
139-
"@vue-macros/volar/define-model",
139+
"@vue-macros/volar/define-models",
140140
"@vue-macros/volar/define-props",
141141
"@vue-macros/volar/define-props-refs",
142142
"@vue-macros/volar/short-vmodel",

docs/guide/configurations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ VueMacros({
2121
},
2222

2323
/** Defaults to true */
24-
defineModel: {
24+
defineModels: {
2525
/**
2626
* Unified mode, only works for Vue 2
2727
*

docs/macros/define-model.md renamed to docs/macros/define-models.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
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
1917
VueMacros({
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
}

docs/macros/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Please make sure `unplugin-vue-macros` is set up correctly. If you haven't yet,
99
- [defineOptions](/macros/define-options)
1010
- [defineSlots](/macros/define-slots)
1111
- [WIP](https://github.com/vuejs/core/pull/7982)
12-
- [defineModel](/macros/define-model) (:warning: inconsistent with official version)
12+
- [defineModels](/macros/define-models) (:warning: inconsistent with official version)
1313
- WIP
1414
- [shortEmits](/macros/short-emits)
1515

docs/zh-CN/guide/bundler-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ npm i -D @vue-macros/volar
136136
"vueCompilerOptions": {
137137
"plugins": [
138138
"@vue-macros/volar/define-options",
139-
"@vue-macros/volar/define-model",
139+
"@vue-macros/volar/define-models",
140140
"@vue-macros/volar/define-props",
141141
"@vue-macros/volar/define-props-refs",
142142
"@vue-macros/volar/short-vmodel",

docs/zh-CN/guide/configurations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ VueMacros({
2121
},
2222

2323
/** 默认是 true */
24-
defineModel: {
24+
defineModels: {
2525
/**
2626
* unified 模式,仅在 Vue 2 有效
2727
*

docs/zh-CN/macros/define-model.md renamed to docs/zh-CN/macros/define-models.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# defineModel
1+
# defineModels
22

33
<StabilityLevel level="stable" />
44

5-
使用 `defineModel` 可以简化声明和修改 `v-model` 值的步骤,就像是在使用一个普通变量一样。
6-
7-
在 Vue >= 3.3 中,此功能将默认关闭。
5+
使用 `defineModels` 可以简化声明和修改 `v-model` 值的步骤,就像是在使用一个普通变量一样。
86

97
| 特性 | 支持 |
108
| :----------: | :----------------: |
@@ -17,7 +15,7 @@
1715

1816
```ts
1917
VueMacros({
20-
defineModel: {
18+
defineModels: {
2119
/**
2220
* Unified 模式,仅在 Vue 2 下有效
2321
*
@@ -34,7 +32,7 @@ VueMacros({
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 @@ const { modelValue } = defineModel<{
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, // 或 2.7 用于 Vue 2
124122
"plugins": [
125-
"@vue-macros/volar/define-model"
123+
"@vue-macros/volar/define-models"
126124
// ...更多功能
127125
],
128-
"defineModel": {
126+
"defineModels": {
129127
// 仅在 target 是 2.7 时有效
130128
"unified": true
131129
}

0 commit comments

Comments
 (0)