1.1.3 • Published 5 years ago

vue-nsmixin v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

vue-nsmixin

This small script (namespacemixin) provides a solution to use "namespaced" methods, computed and data values.

How to use?

npm i vue-nsmixin
# or
yarn add vue-nsmixin
const NsMixin = require('vue-nsmixin');
// or
import NsMixin from 'vue-nsmixin';

Vue.use(NsMixin, {
  useFn: true // use namespace function for methods
  seperator: '', // default "__"
  firstLetterUpperCase: false // set first letter of method, data or computed to uppercase
});

Now you can do this:

Vue.nsMixin('namespace', {
  // ...options
  data() {
    return {
      value: ''
    }
  },
  computed: {
    cpValue() {
      // ...
    }
  }
  methods: {
    func() {
      // ...
    }
  }
});

In your component:

this.namespace().func(); // to use this set useFn: true in options

// or

this.namespace__func(); // method

this.namespace__value; // data
this.namespace__cpValue; // computed
1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago