vue-ref-store

1.0.3 • Public • Published

vue-ref-store

The store of vue-ref for vue, it needs to be used with vue-ref pachage.




Getting started

The store of vue-ref for vue, it needs to be used with vue-ref pachage.

  1. 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

  1. 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>

  1. 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




Readme

Keywords

Package Sidebar

Install

npm i vue-ref-store

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

10 kB

Total Files

6

Last publish

Collaborators

  • louisnikai