vue动态改变标题

在router/index.js写路由的js中添加一段代码:

router.beforeEach((to, from, next) => {
  const { title } = to.meta
  if (title) {
    document.title = `标题 | ${title}`
  }
  next()
})
export default router
原文地址:https://www.cnblogs.com/kpengfang/p/14105108.html