Skip to content

Commit f13d1ef

Browse files
committed
feat: Ref重命名Mut
1 parent 6b46636 commit f13d1ef

File tree

14 files changed

+35
-35
lines changed

14 files changed

+35
-35
lines changed

docs/guide/api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313
# 装饰器
1414

15-
## Track
15+
## Mut
1616
- Type: 属性装饰器
1717

1818
声明变量为响应式
1919

2020
```tsx
2121
class Foo extends VueComponent {
22-
@Track() count = 1
22+
@Mut() count = 1
2323
}
2424
```
2525

@@ -30,7 +30,7 @@ class Foo extends VueComponent {
3030

3131
```tsx
3232
class Foo extends VueComponent {
33-
@Track() count = 1
33+
@Mut() count = 1
3434

3535
@Computed()
3636
get doubleCount() {

docs/guide/component.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ class Foo extends VueComponent {
7171

7272
## 响应式变量
7373

74-
响应式变量使用装饰器注解一下,主要有2个 `Track``Computed`,此时忘记 `.value` 的事情,
74+
响应式变量使用装饰器注解一下,主要有2个 `Mut``Computed`,此时忘记 `.value` 的事情,
7575
就是正常普通的变量定义,加上装饰器就是告诉框架当此变量变化的时候我要刷新视图
7676

7777
```tsx
7878
class Foo extends VueComponent {
79-
@Track() count = 1
79+
@Mut() count = 1
8080

8181
@Computed()
8282
get doubleCount() {
@@ -123,7 +123,7 @@ class Foo extends VueComponent {
123123
watch(() => this.count, (n, o) => console.log('change', n, o))
124124
}
125125

126-
@Track() count = 1
126+
@Mut() count = 1
127127

128128
render() {
129129
return <span onClick={() => this.count++}>{this.count}</span>

docs/guide/di.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Injectable } from 'injection-js'
1616
// 定义服务 加上此装饰器表明我有需要其他服务,如果不需要,可以不加
1717
@Injectable()
1818
class CountService extends VueService {
19-
@Track() count = 1
19+
@Mut() count = 1
2020

2121
add() {
2222
this.count++
@@ -46,7 +46,7 @@ import { VueComponent } from './component'
4646
import { SkipSelf } from 'injection-js'
4747

4848
class CountService extends VueService {
49-
@Track() count = 1
49+
@Mut() count = 1
5050

5151
add() {
5252
this.count++

docs/guide/service.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class PositionService extends VueService {
3838
onBeforeUnmount(() => window.removeEventListener('mousemove', this.change))
3939
}
4040

41-
@Track() x = 0
42-
@Track() y = 0
41+
@Mut() x = 0
42+
@Mut() y = 0
4343

4444
@Autobind()
4545
private change(e: MouseEvent) {

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Foo extends VueComponent<Foo_Props> {
3939
}
4040

4141
// 组件自身状态
42-
@Track() count = 1
42+
@Mut() count = 1
4343

4444
// 计算属性
4545
@Computed()

example/count.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Autobind, Track, VueService } from '@/index'
1+
import { Autobind, Mut, VueService } from '@/index'
22

33
export class CountService extends VueService {
4-
@Track() count = 1
4+
@Mut() count = 1
55

66
@Autobind()
77
add() {

example/example.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Autobind, Track, VueComponent, VueService } from 'vue3-oop'
1+
import { Autobind, Mut, VueComponent, VueService } from 'vue3-oop'
22
import { onBeforeUnmount } from 'vue'
33

44
class PositionService extends VueService {
@@ -8,8 +8,8 @@ class PositionService extends VueService {
88
onBeforeUnmount(() => window.removeEventListener('mousemove', this.change))
99
}
1010

11-
@Track() x = 0
12-
@Track() y = 0
11+
@Mut() x = 0
12+
@Mut() y = 0
1313

1414
@Autobind()
1515
private change(e: MouseEvent) {

example/module/auth/login.view.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, VueComponent } from '@/index'
22
import { UserService } from './user.service'
33
import { Button, Col, Form, Input, Row } from 'ant-design-vue'
4-
import { Track } from '@/decorators/track'
4+
import { Mut } from '@/decorators/mut'
55
import { CatchLoading } from '../../common/decorators/catch.decorator'
66
import { Autobind } from '@/helper'
77
import { CountService } from '../../count.service'
@@ -19,8 +19,8 @@ export default class LoginView extends VueComponent {
1919
) {
2020
super()
2121
}
22-
@Track() loading = false
23-
@Track() model = {
22+
@Mut() loading = false
23+
@Mut() model = {
2424
name: '',
2525
pwd: '',
2626
}

example/module/auth/user.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Hook, Track, VueService } from '@/index'
1+
import { Hook, Mut, VueService } from '@/index'
22
import { Inject, Injectable } from 'injection-js'
33
import { RouterService } from '../../router/router.service'
44
import { AxiosInstance } from 'axios'
@@ -11,7 +11,7 @@ export class UserService extends VueService {
1111
this.guardHttp()
1212
this.guardRouter()
1313
}
14-
@Track() token = ''
14+
@Mut() token = ''
1515

1616
private _requestGuard: number
1717

example/size.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Hook, Track, VueService } from 'vue3-oop'
1+
import { Hook, Mut, VueService } from 'vue3-oop'
22
import { ref, watchEffect } from 'vue'
33
import { debounce } from 'lodash-es'
44

@@ -21,8 +21,8 @@ export class SizeService extends VueService {
2121
this.debounceSet(entry.target.clientWidth, entry.target.clientHeight)
2222
}
2323
})
24-
@Track() x = 0
25-
@Track() y = 0
24+
@Mut() x = 0
25+
@Mut() y = 0
2626

2727
debounceSet = debounce((x: number, y: number) => {
2828
this.x = x

0 commit comments

Comments
 (0)