vue-ref-store
v1.0.3
Published
The store of vue-ref for vue, it needs to be used with vue-ref pachage.
Downloads
1
Readme
Getting started
The store of vue-ref for vue, it needs to be used with vue-ref pachage.
- Install the package:
npm install --save vue-ref-store
Usage
You can add the package into your app, or import and create instance of VueRefStore.
Examples
- Add the package into your app:
import Vue from 'vue'
import VueRefStore from 'vue-ref-store'
Vue.use(VueRefStore)
or
Vue.use(VueLsLoader, {name: [directiveName]})
PS: This way will auto use vue-ref and add $vueRefStore property for Vue instance. Then you can use it in vue component:
<template>
<div>
<[element] key="[refName]" v-ref="(com, key) => $vueRefStore.setChildrenRef(key, com)"></[element]>
</div>
</template>
<script>
export default {
methods: {
test() {
let refVueObj = this.$vueRefStore.getChildrenRef("[refName]");
if (!!refVueObj) {
...
}
}
}
};
</script>
- Import and create instance of VueRefStore:
<template>
<div>
<[element] key="[refName]" v-ref="(com, key) => $vueRefStore.setChildrenRef(key, com)"></[element]>
</div>
</template>
<script>
import { VueRefStore } from 'vue-ref-store';
export default {
beforeCreate() {
this.$vueRefStore = new VueRefStore(this);
},
methods: {
test() {
let refVueObj = this.$vueRefStore.getChildrenRef("[refName]");
if (!!refVueObj) {
...
}
}
}
};
</script>
Change Log
CHANGELOG.md