0👍
You can use the mapGetters
helper to more easily import getters from your store as computed properties.
For example, in your component:
import { mapGetters } from 'vuex'
export default {
// ...
computed: {
// mix the getters into computed with object spread operator
...mapGetters([
'hasPermission',
// ...
])
}
}
- [Vuejs]-How to pass pass pramas in b-nav-item using store getters?
- [Vuejs]-Vue Js Applications Failed to Display the Page
0👍
I’d recommend using vuex, however it is possible by using provide / inject.
For example in your main app:
provide: {
user: {
admin: true
}
}
And then in child components:
inject: ['user'],
created () {
console.log(this.user);
}
- [Vuejs]-Vue component data not changing in method
- [Vuejs]-VueJS unknow custom element VueStripeCheckout
Source:stackexchange.com