方法多种,现取其一:
传入参数:
{
path: '/outlink',
component: resolve => require(['../components/page/outlink.vue'], resolve),
meta: { title: 'outlink' },
props: {
id: "1",
name: "steven"
}
}
接受参数:
export default {
props: ["id", "userName"],
data() {
return {
src: "https://www.baidu.com/"
};
},
mounted() {
if (this.id == "1") {
this.src = "http://localhost:8080/#/t_link";
}
if (this.id == "2") {
this.src = "http://localhost:8080/#/drag";
}
}
};