最近做项目的时候,涉及到页面跳转,看了网上的各种攻略:
`window.open(url,'_blank')
windows.location.herf=url
this.$router.push
const { href } = this.$router.resolve({
name: "ArticleDetail",
params: { id: 0 }
});
window.open(href, '_blank');`
请问大佬,这几方式有什么区别 可以混着用貌似
如果说我用的项目 遍历的过程中会出现第三方网站的href
用那种方式比较好?
window.open(url,'_blank')
是打开新窗口链接windows.location.herf=url
是当前页跳转后面两种是vue router的跳转方法
如果项目里面用到第三方网站的href,那肯定选择前两种,用哪种还是要看具体需求。