vue2来回切换路由,如何阻止router-view的组件每次都刷新,每次都发起请求

组件1 one.vue和组件2 two.vue都发起这个请求,反复来回切换,每次都请求,如何阻止,路由地址是固定的。


mounted: function () {


        axios.get('http://192.168.137.1/jsonp-test/data/dish_getbypage.php?start=2')

            .then((response)=> {

            console.log(response)

            this.foodsList=response.data

        }).catch((error) => {

            console.log(error)

        })

    }


喵喵时光机
浏览 368回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript