学无先后,达者为师

网站首页 Vue 正文

vue 路由跳转并打开新页面【详细】

作者:mwh321 更新时间: 2021-12-15 Vue

1.路由

  {
    path: '/Login',
    name: 'Login',
    title: '登录',
    component: () => import('@/views/Login'),
  },

2.点击路由跳转新页面

<button class="btns" type="button" @click="showLogdialog()">登录</button>

methods: {
    // 登录
    showLogdialog() {
      let routeUrl = this.$router.resolve({
        path: '/Login',
        query: {
          companyName: 'Login'
        }
      })
      window.open(routeUrl.href, '_blank')
    },
    }

原文链接:https://blog.csdn.net/mwh321/article/details/122099767

栏目分类
最近更新