Answers for "[Vue warn]: Error in mounted hook: "TypeError: this.$store is undefined""

0

[Vue warn]: Error in mounted hook: "TypeError: this.$store is undefined"

//You are not importing Vuex and adding the store to Vue.
//In your index file import your store:

import Vue from 'vue'
import Vuex from 'vuex'
import store from './store' // change path if necessary
//Then use it:

Vue.use(Vuex)

//And add it to Vue so that it can accessed via this.$store:

new Vue({
  el: '#recommendedProductsDetailsHorizontal',
  store,
  components: {ProductSlider},
  data: { params },
  template: '<product-slider/>'
Posted by: Guest on May-05-2021

Code answers related to "[Vue warn]: Error in mounted hook: "TypeError: this.$store is undefined""

Code answers related to "Javascript"

Browse Popular Code Answers by Language