标签跳转:相当于a标签,在页面点击后跳转到to指定的路径文件
<router-link to="HelloWorld(网页路径或名字)"></router-link>
在script>methods中:
变量名:function(){
固定写法-->this.$router.push({
? name:跳转网页的名字,
? query: {
???? id(变量名):赋值url后面的参数
???? test(变量名)赋值url后面的参数
}
? )}
}
methods:{ ???ufo: function(){ ??????this.$router.push({ ????????name:FuckWorld, ????????query: { ??????????ie:utf-8, ????????} ??????}) ???} ?}
第二种跳转:不可回退的跳转代码
?methods:{ ???ufo: function(){ ??????this.$router.replace({ ????????name:FuckWorld, ????????query: { ??????????ie:utf-8, ????????} ??????}) ???} ?}
VUE的标签跳转和在script中的JS跳转代码
原文地址:https://www.cnblogs.com/xiaozhu007/p/8159384.html