1. router.push 和 router.resolve
知识点 (router.push 和 router.resolve)
1.1 打开方式:
router.push 只能当前窗口打开
router.resolve 结合 window.open 可以新窗口打开
1.2.参数传递:
router.push 支持query和params
router.resolve 只支持query,若需地址栏参数不可见,需结合localStorage或第三方插件保存
地址栏带参实现:
const {href}=this.$router.resolve({ path: "/newsInfo", query: { id: row.noticeId } });
window.open(href,'_blank')
地址栏不带参实现:
let data = this.$router.resolve({
name: 'channel_sms',
});
localStorage.setItem('a', 1);
// 然后跳转页接收 localStorage.getItem('a')