Skip to content

Commit 59d23c4

Browse files
committed
model
1 parent 295cff9 commit 59d23c4

File tree

12 files changed

+26
-44
lines changed

12 files changed

+26
-44
lines changed

docs/en/_sidebar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- [Reference](/en/class-component/reference/reference.md)
1212
- [Watcher](/en/class-component/watcher/watcher.md)
1313
- [Injection](/en/class-component/injection/injection.md)
14-
- [VModel](/en/class-component/v-model/v-model.md)
14+
- [Model](/en/class-component/model/model.md)
1515
- Inheritance
1616
- [ECMAScript class](/en/inheritance/es-class/es-class.md)
1717
- [Component](/en/inheritance/component/component.md)

docs/en/class-component/v-model/code-option-name.ts renamed to docs/en/class-component/model/code-option-name.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { VModel, Component, Vue } from 'vue-facing-decorator'
1+
import { Model, Component, Vue } from 'vue-facing-decorator'
22

33
/*
4-
54
Vue options API
65
{
76
props:{
@@ -27,7 +26,7 @@ In other components:
2726

2827
@Component
2928
export default class MyComponent extends Vue {
30-
@VModel({
29+
@Model({
3130
name: 'value'
3231
})
3332
valueAgent!: string

docs/zh-cn/class-component/v-model/code-option-others.ts renamed to docs/en/class-component/model/code-option-others.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { VModel, Component, Vue } from 'vue-facing-decorator'
1+
import { Model, Component, Vue } from 'vue-facing-decorator'
22

33
/*
4-
54
Vue options API
65
{
76
props:{
@@ -22,20 +21,16 @@ Vue options API
2221
}
2322
}
2423
}
25-
2624
*/
2725

2826
/*
29-
3027
In other components:
31-
3228
<MyComponent v-model="foo"></MyComponent>
33-
3429
*/
3530

3631
@Component
3732
export default class MyComponent extends Vue {
38-
@VModel({
33+
@Model({
3934
type: String,
4035
default: 'bar',
4136
//...

docs/en/class-component/v-model/code-usage.ts renamed to docs/en/class-component/model/code-usage.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { VModel, Component, Vue } from 'vue-facing-decorator'
1+
import { Model, Component, Vue } from 'vue-facing-decorator'
22

33
/*
4-
54
Vue options API
65
{
76
props:{
@@ -18,19 +17,15 @@ Vue options API
1817
}
1918
}
2019
}
21-
2220
*/
2321

2422
/*
25-
2623
In other components:
27-
2824
<MyComponent v-model="foo"></MyComponent>
29-
3025
*/
3126

3227
@Component
3328
export default class MyComponent extends Vue {
34-
@VModel
29+
@Model
3530
valueAgent!: string
3631
}

docs/en/class-component/v-model/v-model.md renamed to docs/en/class-component/model/model.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Usage
22

3-
Use `VModel` decorator to define a model for vue `v-model` or `v-model:foo`.
3+
Use `Model` decorator to define a model for vue `v-model` or `v-model:foo`.
4+
5+
> Alias of old `VModel` decorator. `VModel` will be supported in the future, but we recommend to update to `Model`.
46
57
[](./code-usage.ts ':include :type=code typescript')
68

docs/zh-cn/_sidebar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- [引用](/zh-cn/class-component/reference/reference.md)
1212
- [监视器](/zh-cn/class-component/watcher/watcher.md)
1313
- [注入](/zh-cn/class-component/injection/injection.md)
14-
- [VModel](/zh-cn/class-component/v-model/v-model.md)
14+
- [Model](/zh-cn/class-component/model/model.md)
1515
- 继承
1616
- [ECMAScript 类 继承](/zh-cn/inheritance/es-class/es-class.md)
1717
- [组件 继承](/zh-cn/inheritance/component/component.md)

docs/zh-cn/class-component/v-model/code-option-name.ts renamed to docs/zh-cn/class-component/model/code-option-name.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { VModel, Component, Vue } from 'vue-facing-decorator'
1+
import { Model, Component, Vue } from 'vue-facing-decorator'
22

33
/*
4-
54
Vue options API
65
{
76
props:{
@@ -21,13 +20,13 @@ Vue options API
2120
*/
2221

2322
/*
24-
In other components:
23+
在另一个组件中:
2524
<MyComponent v-model:value="foo"></MyComponent>
2625
*/
2726

2827
@Component
2928
export default class MyComponent extends Vue {
30-
@VModel({
29+
@Model({
3130
name: 'value'
3231
})
3332
valueAgent!: string

docs/en/class-component/v-model/code-option-others.ts renamed to docs/zh-cn/class-component/model/code-option-others.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { VModel, Component, Vue } from 'vue-facing-decorator'
1+
import { Model, Component, Vue } from 'vue-facing-decorator'
22

33
/*
4-
54
Vue options API
65
{
76
props:{
@@ -22,20 +21,16 @@ Vue options API
2221
}
2322
}
2423
}
25-
2624
*/
2725

2826
/*
29-
30-
In other components:
31-
27+
在另一个组件中:
3228
<MyComponent v-model="foo"></MyComponent>
33-
3429
*/
3530

3631
@Component
3732
export default class MyComponent extends Vue {
38-
@VModel({
33+
@Model({
3934
type: String,
4035
default: 'bar',
4136
//...

docs/zh-cn/class-component/v-model/code-usage.ts renamed to docs/zh-cn/class-component/model/code-usage.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { VModel, Component, Vue } from 'vue-facing-decorator'
1+
import { Model, Component, Vue } from 'vue-facing-decorator'
22

33
/*
4-
54
Vue options API
65
{
76
props:{
@@ -18,19 +17,15 @@ Vue options API
1817
}
1918
}
2019
}
21-
2220
*/
2321

2422
/*
25-
2623
In other components:
27-
2824
<MyComponent v-model="foo"></MyComponent>
29-
3025
*/
3126

3227
@Component
3328
export default class MyComponent extends Vue {
34-
@VModel
29+
@Model
3530
valueAgent!: string
3631
}

docs/zh-cn/class-component/v-model/v-model.md renamed to docs/zh-cn/class-component/model/model.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## 用法
22

3-
使用装饰器`VModel`去定义vue `v-model``v-model:foo`
3+
使用装饰器`Model`去定义vue `v-model``v-model:foo`
4+
5+
> 这是`VModel`装饰器的别名。`VModel`在未来会被继续支持,但是我们建议升级到`Model`.
46
57
[](./code-usage.ts ':include :type=code typescript')
68

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export { decorator as Watch } from './option/watch'
55
export { decorator as Prop } from './option/props'
66
export { decorator as Inject } from './option/inject'
77
export { decorator as Emit } from './option/emit'
8-
export { decorator as VModel } from './option/vmodel'
8+
export { decorator as VModel, decorator as Model } from './option/vmodel'
99
import type {
1010
ComponentPublicInstance
1111
} from 'vue'

test/option/vmodel.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

22
import { expect } from 'chai';
33
import 'mocha';
4-
import { Component, VModel, Base } from '../../dist'
4+
import { Component, Model, Base } from '../../dist'
55

66
@Component
77
export class Comp extends Base {
88

9-
@VModel
9+
@Model
1010
defaultValueAgent!:string
1111

12-
@VModel({
12+
@Model({
1313
name:'value',
1414
required:true
1515
})

0 commit comments

Comments
 (0)