1.0.3 • Published 3 years ago

vue-ref-store v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago