vue-decorator-ref
Version:
vue-decorator-ref =====================
78 lines (57 loc) • 1.17 kB
Markdown
vue-decorator-ref
=====================
# Description
Use along with `vue-class-componenet`
Add a new Decorator `` to inject refs into class property.
# install
```sh
$ npm install vue-decorator-ref
```
# use example
## 1 add plugin
```ts
import {Plugin as VueComponenetRefPlugin} from "vue-decorator-ref";
...
Vue.use(VueComponenetRefPlugin);
```
## 2 use in code (typescript)
```typescript
export default class TabPage extends Vue{
tabController : TabController;
mounted(){
//use with self.tabController;
this.tabController;
...
}
}
```
# Usege
```typescript
// case #1
// when refName is not given,then get one whose name is as same as propertyName
property;
// as same as :
// property = this.$refs['property]
// case #2
property;
// as same as :
// property = this.$refs['vue']
// case #3
// camelcased refName will find refName first then try decamelized one
property;
// as same as :
// property = this.$refs['someVue']
// and if someVue is null then try
// property = this.$refs['some-vue']
```
# Licence
MIT