290 votes
0 answers
javascript - Nuxt.js mounted hook not firing when page redirect
I am implementing facebook view content event with Nuxt.js and have issue with mounted hook. So the issue is when first page loading, mounted logged but whenever back to opened page, it isn't firing mounted hook. This is my code.
import { mapGetters, mapMutations, mapActions } from 'vuex'
export default {
...
async mounted(){
console.log('mounted')
console.log(this.namespace)
console.log(this.$store.state)
if (this.$store.state[this.namespace]) {
this.productView({ product, selectedVariant })
}
},
methods: {
...mapActions('events', ['productView'])
}
}
As I said above, when I first load the page, I can see the log but whenever I return page, it isn't logging and page view event is also not firing.
I am using Vercel and Nuxt for Shopify headless.
Undefined asked
Source
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.