Skip to content

Commit

Permalink
feat: 增加vue实例的方法
Browse files Browse the repository at this point in the history
  • Loading branch information
agileago committed Mar 23, 2022
1 parent 7d49ee7 commit aeb9ad9
Show file tree
Hide file tree
Showing 10 changed files with 397 additions and 320 deletions.
4 changes: 4 additions & 0 deletions docs/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ class Foo extends VueComponent {

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

## useForwardRef

在HOC组件中使用这个方法可以转发真正的ref


# 类型

Expand Down
3 changes: 1 addition & 2 deletions example/module/basic/hello-world/count.comp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ interface CountCompProps {

export class CountComp extends VueComponent<CountCompProps> {
static defaultProps: ComponentProps<CountCompProps> = ['size']

render() {
return <div>{this.props.size}</div>
return <div>111</div>
}
}
7 changes: 3 additions & 4 deletions example/module/basic/hello-world/hello-world.view.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Hook, Link, useForwardRef, VueComponent } from 'vue3-oop'
import { Hook, Link, Mut, useForwardRef, VueComponent } from 'vue3-oop'
import { Input, type InputProps } from 'ant-design-vue'
import { ref } from 'vue'

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

class Abc extends VueComponent {
a = ref(0)
@Mut() a = 0

render() {
return <div>{this.a.value}</div>
return <div onClick={() => this.a++}>{this.a}</div>
}
}

Expand Down
32 changes: 18 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@
"homepage": "https://agileago.github.io/vue3-oop",
"license": "MIT",
"devDependencies": {
"@abraham/reflection": "^0.9.1",
"@commitlint/cli": "^16.2.1",
"@abraham/reflection": "^0.10.0",
"@commitlint/cli": "^16.2.3",
"@nexhome/yorkie": "^2.0.8",
"@release-it/conventional-changelog": "^4.2.0",
"@release-it/conventional-changelog": "^4.2.2",
"@types/lodash-es": "^4.17.6",
"@types/markdown-it": "^12.2.3",
"@types/node": "^17.0.21",
"@types/node": "^17.0.22",
"@types/prettier": "^2.4.4",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"@vitejs/plugin-vue": "^2.2.4",
"@vitest/ui": "^0.5.9",
"@vitest/ui": "^0.7.7",
"@vue/test-utils": "^2.0.0-rc.18",
"@vue3-oop/plugin-vue-jsx": "^1.4.0",
"ant-design-vue": "^3.0.0-beta.8",
Expand All @@ -71,24 +71,24 @@
"commitizen": "^4.2.4",
"commitlint-config-cz": "^0.13.3",
"cz-customizable": "^6.3.0",
"eslint": "^8.10.0",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"happy-dom": "^2.45.0",
"happy-dom": "^2.50.0",
"injection-js": "^2.4.0",
"lint-staged": "^12.3.4",
"lint-staged": "^12.3.7",
"lodash-es": "^4.17.21",
"prettier": "^2.5.1",
"release-it": "^14.12.5",
"prettier": "^2.6.0",
"release-it": "^14.13.1",
"rimraf": "^3.0.2",
"sass": "^1.49.9",
"tslib": "^2.3.1",
"typescript": "^4.6.2",
"vite": "^2.8.6",
"vitepress": "^0.22.3",
"vitest": "^0.5.9",
"vitest": "^0.7.7",
"vue": "^3.2.31",
"vue-router": "^4.0.13"
"vue-router": "^4.0.14"
},
"gitHooks": {
"pre-commit": "lint-staged",
Expand Down Expand Up @@ -123,6 +123,10 @@
"infile": "CHANGELOG.md",
"ignoreRecommendedBump": true
}
},
"github": {
"release": true,
"web": true
}
}
}
Loading

0 comments on commit aeb9ad9

Please sign in to comment.