2.0.0 • Published 6 years ago
@jf/vue-prop-sep v2.0.0
vue-prop-sep 
Add get, has, remove and set methods to Vue componentes.
Usage
Using . as separator (by default).
import VuePropSep from 'vue-prop-sep';
import Vue from 'vue';
Vue.use(VuePropSep);
// Vue component
export default {
data()
{
return {
a : {
b : 1
}
}
},
created()
{
console.log(this.get('a.b')); // 1
this.set('a.b', 5);
console.log(this.get('a.b')); // 5
}
}Changing default separator.
import VuePropSep from 'vue-prop-sep';
import Vue from 'vue';
Vue.use(
VuePropSep,
{
separator : '/'
}
);
// Vue component
export default {
data()
{
return {
a : {
b : 1
}
}
},
created()
{
console.log(this.get('a/b')); // 1
this.set('a/b', 5);
console.log(this.get('a/b')); // 5
}
}2.0.0
6 years ago
