Skip to content

Commit aeb9ad9

Browse files
committed
feat: 增加vue实例的方法
1 parent 7d49ee7 commit aeb9ad9

File tree

10 files changed

+397
-320
lines changed

10 files changed

+397
-320
lines changed

docs/guide/api.md

+4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ class Foo extends VueComponent {
107107

108108
在外部服务中获取当前的最近一级的注射器
109109

110+
## useForwardRef
111+
112+
在HOC组件中使用这个方法可以转发真正的ref
113+
110114

111115
# 类型
112116

example/module/basic/hello-world/count.comp.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ interface CountCompProps {
66

77
export class CountComp extends VueComponent<CountCompProps> {
88
static defaultProps: ComponentProps<CountCompProps> = ['size']
9-
109
render() {
11-
return <div>{this.props.size}</div>
10+
return <div>111</div>
1211
}
1312
}

example/module/basic/hello-world/hello-world.view.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Hook, Link, useForwardRef, VueComponent } from 'vue3-oop'
1+
import { Hook, Link, Mut, useForwardRef, VueComponent } from 'vue3-oop'
22
import { Input, type InputProps } from 'ant-design-vue'
3-
import { ref } from 'vue'
43

54
function createBigSizeInput(size: 'small' | 'middle' | 'large') {
65
class BigInput extends VueComponent<Omit<InputProps, 'size'>> {
@@ -22,10 +21,10 @@ function createBigSizeInput(size: 'small' | 'middle' | 'large') {
2221
const BigInput = createBigSizeInput('large')
2322

2423
class Abc extends VueComponent {
25-
a = ref(0)
24+
@Mut() a = 0
2625

2726
render() {
28-
return <div>{this.a.value}</div>
27+
return <div onClick={() => this.a++}>{this.a}</div>
2928
}
3029
}
3130

package.json

+18-14
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@
5151
"homepage": "https://agileago.github.io/vue3-oop",
5252
"license": "MIT",
5353
"devDependencies": {
54-
"@abraham/reflection": "^0.9.1",
55-
"@commitlint/cli": "^16.2.1",
54+
"@abraham/reflection": "^0.10.0",
55+
"@commitlint/cli": "^16.2.3",
5656
"@nexhome/yorkie": "^2.0.8",
57-
"@release-it/conventional-changelog": "^4.2.0",
57+
"@release-it/conventional-changelog": "^4.2.2",
5858
"@types/lodash-es": "^4.17.6",
5959
"@types/markdown-it": "^12.2.3",
60-
"@types/node": "^17.0.21",
60+
"@types/node": "^17.0.22",
6161
"@types/prettier": "^2.4.4",
62-
"@typescript-eslint/eslint-plugin": "^5.13.0",
63-
"@typescript-eslint/parser": "^5.13.0",
62+
"@typescript-eslint/eslint-plugin": "^5.16.0",
63+
"@typescript-eslint/parser": "^5.16.0",
6464
"@vitejs/plugin-vue": "^2.2.4",
65-
"@vitest/ui": "^0.5.9",
65+
"@vitest/ui": "^0.7.7",
6666
"@vue/test-utils": "^2.0.0-rc.18",
6767
"@vue3-oop/plugin-vue-jsx": "^1.4.0",
6868
"ant-design-vue": "^3.0.0-beta.8",
@@ -71,24 +71,24 @@
7171
"commitizen": "^4.2.4",
7272
"commitlint-config-cz": "^0.13.3",
7373
"cz-customizable": "^6.3.0",
74-
"eslint": "^8.10.0",
74+
"eslint": "^8.11.0",
7575
"eslint-config-prettier": "^8.5.0",
7676
"eslint-plugin-prettier": "^4.0.0",
77-
"happy-dom": "^2.45.0",
77+
"happy-dom": "^2.50.0",
7878
"injection-js": "^2.4.0",
79-
"lint-staged": "^12.3.4",
79+
"lint-staged": "^12.3.7",
8080
"lodash-es": "^4.17.21",
81-
"prettier": "^2.5.1",
82-
"release-it": "^14.12.5",
81+
"prettier": "^2.6.0",
82+
"release-it": "^14.13.1",
8383
"rimraf": "^3.0.2",
8484
"sass": "^1.49.9",
8585
"tslib": "^2.3.1",
8686
"typescript": "^4.6.2",
8787
"vite": "^2.8.6",
8888
"vitepress": "^0.22.3",
89-
"vitest": "^0.5.9",
89+
"vitest": "^0.7.7",
9090
"vue": "^3.2.31",
91-
"vue-router": "^4.0.13"
91+
"vue-router": "^4.0.14"
9292
},
9393
"gitHooks": {
9494
"pre-commit": "lint-staged",
@@ -123,6 +123,10 @@
123123
"infile": "CHANGELOG.md",
124124
"ignoreRecommendedBump": true
125125
}
126+
},
127+
"github": {
128+
"release": true,
129+
"web": true
126130
}
127131
}
128132
}

0 commit comments

Comments
 (0)