0👍
You can try creating a Mixins
file and add the computed property in it.
Mixin named test-mixin
export default {
computed: {
filteredPlans: {
get() {
let res = [];
if (this.query.length > 1) {
this.plans.forEach(p => {
if (JSON.stringify(p).includes(this.query)) res.push(p);
});
return res;
} else return this.plans;
},
set() {
return this.plans;
}
}
},
}
This can be reused in any component by importing the mixin
file like follows
import testMixin from 'test-mixin';
export default {
mixins: [testMixin]
}
- [Vuejs]-How can i access to 'download_url' in json using vuejs
- [Vuejs]-How do i correctly reference Vue.js node_module from electron-forge boilerplate?
Source:stackexchange.com