使用了兩層<router-view>,在第二層的頁面中,代碼如下所示:
<template>
...
<router-link :to="{name: 'testA'}">AAAAA</router-link>
<router-link :to="{name: 'testB'}">BBBBB</router-link>
<router-view></router-view>
...
</template>
<script>
...
mounted () {
console.log('into this page')
}
</script>
回圈點擊AAAAA和BBBBB兩個鏈接,每次都會重新加載當前頁面,也就是console.log(‘into this page’)都會被執行,截圖如下:

在上一層的<router-view>中,父頁面不會被重新加載,請問為什么這個頁面每次都會重新加載呢?
uj5u.com熱心網友回復:
知道原因了,是另一個地方代碼的問題。不麻煩大家了,謝謝。uj5u.com熱心網友回復:
你的第二層router-view是需要作快取是嗎轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/239261.html
標籤:其他技術討論專區
上一篇:OpenCV的相機標定代碼問題
