File tree 12 files changed +26
-44
lines changed
12 files changed +26
-44
lines changed Original file line number Diff line number Diff line change 11
11
- [ Reference] ( /en/class-component/reference/reference.md )
12
12
- [ Watcher] ( /en/class-component/watcher/watcher.md )
13
13
- [ 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 )
15
15
- Inheritance
16
16
- [ ECMAScript class] ( /en/inheritance/es-class/es-class.md )
17
17
- [ Component] ( /en/inheritance/component/component.md )
Original file line number Diff line number Diff line change 1
- import { VModel , Component , Vue } from 'vue-facing-decorator'
1
+ import { Model , Component , Vue } from 'vue-facing-decorator'
2
2
3
3
/*
4
-
5
4
Vue options API
6
5
{
7
6
props:{
@@ -27,7 +26,7 @@ In other components:
27
26
28
27
@Component
29
28
export default class MyComponent extends Vue {
30
- @VModel ( {
29
+ @Model ( {
31
30
name : 'value'
32
31
} )
33
32
valueAgent ! : string
Original file line number Diff line number Diff line change 1
- import { VModel , Component , Vue } from 'vue-facing-decorator'
1
+ import { Model , Component , Vue } from 'vue-facing-decorator'
2
2
3
3
/*
4
-
5
4
Vue options API
6
5
{
7
6
props:{
@@ -22,20 +21,16 @@ Vue options API
22
21
}
23
22
}
24
23
}
25
-
26
24
*/
27
25
28
26
/*
29
-
30
27
In other components:
31
-
32
28
<MyComponent v-model="foo"></MyComponent>
33
-
34
29
*/
35
30
36
31
@Component
37
32
export default class MyComponent extends Vue {
38
- @VModel ( {
33
+ @Model ( {
39
34
type : String ,
40
35
default : 'bar' ,
41
36
//...
Original file line number Diff line number Diff line change 1
- import { VModel , Component , Vue } from 'vue-facing-decorator'
1
+ import { Model , Component , Vue } from 'vue-facing-decorator'
2
2
3
3
/*
4
-
5
4
Vue options API
6
5
{
7
6
props:{
@@ -18,19 +17,15 @@ Vue options API
18
17
}
19
18
}
20
19
}
21
-
22
20
*/
23
21
24
22
/*
25
-
26
23
In other components:
27
-
28
24
<MyComponent v-model="foo"></MyComponent>
29
-
30
25
*/
31
26
32
27
@Component
33
28
export default class MyComponent extends Vue {
34
- @VModel
29
+ @Model
35
30
valueAgent ! : string
36
31
}
Original file line number Diff line number Diff line change 1
1
## Usage
2
2
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 ` .
4
6
5
7
[ ] ( ./code-usage.ts ' :include :type=code typescript ')
6
8
Original file line number Diff line number Diff line change 11
11
- [ 引用] ( /zh-cn/class-component/reference/reference.md )
12
12
- [ 监视器] ( /zh-cn/class-component/watcher/watcher.md )
13
13
- [ 注入] ( /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 )
15
15
- 继承
16
16
- [ ECMAScript 类 继承] ( /zh-cn/inheritance/es-class/es-class.md )
17
17
- [ 组件 继承] ( /zh-cn/inheritance/component/component.md )
Original file line number Diff line number Diff line change 1
- import { VModel , Component , Vue } from 'vue-facing-decorator'
1
+ import { Model , Component , Vue } from 'vue-facing-decorator'
2
2
3
3
/*
4
-
5
4
Vue options API
6
5
{
7
6
props:{
@@ -21,13 +20,13 @@ Vue options API
21
20
*/
22
21
23
22
/*
24
- In other components :
23
+ 在另一个组件中 :
25
24
<MyComponent v-model:value="foo"></MyComponent>
26
25
*/
27
26
28
27
@Component
29
28
export default class MyComponent extends Vue {
30
- @VModel ( {
29
+ @Model ( {
31
30
name : 'value'
32
31
} )
33
32
valueAgent ! : string
Original file line number Diff line number Diff line change 1
- import { VModel , Component , Vue } from 'vue-facing-decorator'
1
+ import { Model , Component , Vue } from 'vue-facing-decorator'
2
2
3
3
/*
4
-
5
4
Vue options API
6
5
{
7
6
props:{
@@ -22,20 +21,16 @@ Vue options API
22
21
}
23
22
}
24
23
}
25
-
26
24
*/
27
25
28
26
/*
29
-
30
- In other components:
31
-
27
+ 在另一个组件中:
32
28
<MyComponent v-model="foo"></MyComponent>
33
-
34
29
*/
35
30
36
31
@Component
37
32
export default class MyComponent extends Vue {
38
- @VModel ( {
33
+ @Model ( {
39
34
type : String ,
40
35
default : 'bar' ,
41
36
//...
Original file line number Diff line number Diff line change 1
- import { VModel , Component , Vue } from 'vue-facing-decorator'
1
+ import { Model , Component , Vue } from 'vue-facing-decorator'
2
2
3
3
/*
4
-
5
4
Vue options API
6
5
{
7
6
props:{
@@ -18,19 +17,15 @@ Vue options API
18
17
}
19
18
}
20
19
}
21
-
22
20
*/
23
21
24
22
/*
25
-
26
23
In other components:
27
-
28
24
<MyComponent v-model="foo"></MyComponent>
29
-
30
25
*/
31
26
32
27
@Component
33
28
export default class MyComponent extends Vue {
34
- @VModel
29
+ @Model
35
30
valueAgent ! : string
36
31
}
Original file line number Diff line number Diff line change 1
1
## 用法
2
2
3
- 使用装饰器` VModel ` 去定义vue ` v-model ` 或` v-model:foo ` 。
3
+ 使用装饰器` Model ` 去定义vue ` v-model ` 或` v-model:foo ` 。
4
+
5
+ > 这是` VModel ` 装饰器的别名。` VModel ` 在未来会被继续支持,但是我们建议升级到` Model ` .
4
6
5
7
[ ] ( ./code-usage.ts ' :include :type=code typescript ')
6
8
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export { decorator as Watch } from './option/watch'
5
5
export { decorator as Prop } from './option/props'
6
6
export { decorator as Inject } from './option/inject'
7
7
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'
9
9
import type {
10
10
ComponentPublicInstance
11
11
} from 'vue'
Original file line number Diff line number Diff line change 1
1
2
2
import { expect } from 'chai' ;
3
3
import 'mocha' ;
4
- import { Component , VModel , Base } from '../../dist'
4
+ import { Component , Model , Base } from '../../dist'
5
5
6
6
@Component
7
7
export class Comp extends Base {
8
8
9
- @VModel
9
+ @Model
10
10
defaultValueAgent ! :string
11
11
12
- @VModel ( {
12
+ @Model ( {
13
13
name :'value' ,
14
14
required :true
15
15
} )
You can’t perform that action at this time.
0 commit comments