Vue3 router路由跳转并打开新窗口

通过router.resolve()返回路由的标准化地址,再使用window.open打开新窗口。

import { useRouter } from 'vue-router';
const router = useRouter();

const url = router.resolve({
   path: '/test-url',
 });
 console.log(url.href);  // 输出为#/test-url
// 打开新窗口
window.open(url.href);
上一篇:x70pro+和x80哪个实用(vivox70pro和vivox80哪个好)
下一篇:vivos7功能介绍(vivos7的功能)