html 代码
<div @cilck="openDeatail(item.id)">点击事件</div>js 代码
openDetail(e) { let routeData = this.$router.resolve({ path: "/detail", query: {id: e} }); window.open(routeData.href, '_blank'); }详情页接受坚定的帅哥
created() { this.init();},methods: {init() { this.id = this.$route.query.id; this.getDetail(this.id) }, getDetail(id) { this.$axios.get(server.url + "dj/detail/" + id, {}).then(res => { console.log(res.data.data); this.ly = res.data.data.ly this.detailData = res.data.data }) }}用 a 链接传参方式
<router-link :to="{path:'/detailNew', query:{ id: item.id }}" tag="a" target="_blank">接受坚定的帅哥
const couponId = this.$route.query.id