I use
import {mapFields} from "vuex-map-fields"
in every component.
How can I make this available in every component without having to import it? Is there any risk to this?
if you want it globally what you have to do it's inject in the Vue instance same way that we do when we use vuex
main.js
import Vue from 'vue'
import store from './store'
new Vue( {
el: '#app',
store,
render: h => h( App )
} );
then in any component you can console.log(this)
; you should be able to see your object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With