How do I refresh the page data when nuxtjs switches routes?

switches like this. It"s all on this page, but the parameters are different later

<nuxt-link to="/test/abc?sq=2">test</nuxt-link>
<nuxt-link to="/test/abc?sq=1">test</nuxt-link>

whether it"s asyncData, or fetch. Or the mounted didn"t execute.
so the page cannot display different data based on the parameter sq,.

Mar.31,2021

watchQuery: ['id']


nuxt-link walks and is processed only in client. If you want to leave server, you can change to test , asyncData and others will trigger the execution of


.

< nuxt-link to= "/ test/abc?sq=2" > test < / nuxt-link >
< nuxt-link to= "/ test/abc?sq=1" > test < / nuxt-link >

correctly it should be watchQuery: ['sq'], and if the defined string changes, all component methods (asyncData, fetch, validate, layout,.) will be called.

the above is transferred from Haichang Wisdom www.hichannel.net


is uncomfortable, and that's what I'm doing right now. Or in mounted to determine whether the this.biz exists, there is no need to use the client call interface.


use watch,

export default {
       
        watch: {
            "$route": function(){
                //
            }
        },
        
    }
Menu