一 vue打开新的标签页

Hearder.vue(修订)

methods: {
            jumphome(location) {
                localStorage.this_nav = location;
                this.$router.push(location);
            },
            jump(location) {
                // 改变永久仓库的值
                localStorage.this_nav = location;
                // vue-router除了提供router-link标签跳转页面以外,还提供了 js跳转的方式
                // this.$router.push(location);
                window.open(location,'_blank')
            },

二 vue-动态渲染标题

main.js(修订)


...

// 动态修改页面标题
router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
});

...


router.js(修订)

...

{
    path: '/',
    name: 'home',
    component: Home,
    meta:{
      title:'vue-❤-yan'
    }

{
    path: '/course',
    name: 'course',
    component: Course,
    meta:{
      title:'实战课'
    }
  },
{
    path: '/Light-Course',
    name: 'Light_Course',
    component: LightCourse,
    meta:{
      title:'轻课'
    }
...

相关文章:

  • 2021-10-11
  • 2022-12-23
  • 2022-02-09
  • 2021-09-08
  • 2021-05-21
  • 2021-06-11
  • 2021-11-17
  • 2022-01-22
猜你喜欢
  • 2021-05-09
  • 2022-01-02
  • 2021-06-12
  • 2022-12-23
  • 2021-06-23
  • 2021-12-30
相关资源
相似解决方案