关于vue的路由跳转问题
论文问答
1
没有办法登录
<van-button type="primary" class="Yca_df58_58e5c52 one" @click="login">登录</van-button>这是button按钮
function login() {
if (flag.value === 1 && flag1.value === 3) {
router.push({ path: "/about" });
}
} 这是逻辑
-
vue中在data定义的变量需要加上this.这个前缀引用,在你可以尝试不加判断直接登录能否直接跳转
function login() { if (this.flag.value === 1 && this.flag1.value === 3) { router.push({ path: "/about" }); } }
不加判断
function login() {//打印这两个的值查看是否正确 console.log(this.flag.value ,this.flag1.value ) router.push({ path: "/about" }); }
-
function login() { console.log(flag) if (flag.value === 1 && flag1.value === 3) { router.push({ path: "/about" }); } }
发表回复