主要思路:
1.可以從路由獲取當前頁面的標題,再通過document.title設值,或者在最外層的index.html頁面添加<title>標簽
import router from './router'
router.beforeEach(async (to, from, next) => {
document.title = to.meta.title
})
2.(主要用於代理網站)如果想要從數據庫獲取的數據修改,那要在App.vue頁面獲取數據,在存放到本地緩存(window.localStorage.setItem),
document.title再從本地緩存拿值(window.localStorage.getItem)(但還有個小問題,一開始進入頁面時要設置默認值)