Vueo

🍟 Easy to get value from vue instance via object paths.

Installation

npm i vueo -S

Import

import Vue from 'vue'
import Vueo from 'vueo'

Vue.use(Vueo)

Or import via script tag

<script src="path/to/vue/dist/vue.js"></script>
<script src="path/to/vueo/dist/vueo.js"></script>

Usage

Live demo

new Vue({
  data () {
    return {
      a: [ { key: 'value' } ],
      b: { c: 1 }
    }
  },

  created() {
    this.$at('a.0.key') // 'value'
    this.$at('a.1.key') // undefined

    this.$at(this.a, '0.key') // 'value'

    this.$has('b') // true
    this.$has('a.1') // false
  }
})

API

Read more

License

MIT