document.title = '修改页面的标题'
可以在路由中修改(根据路由的meta.title设置标题)
router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title
}
next()
})
可以在页面中通过js事件(页面获取和失去焦点)修改页面的标题
window.onfocus = function () {
document.title="页面获得焦点,欢迎回来"
}
window.onblur = function () {
document.title="页面失去焦点,期待归来"
}