uniapp项目首次在微信小程序中运行点击事件正常,重编译后出现click,tap事件无效, 复现步骤: uniapp 第一次编译有效果 重新编译 点击按钮没有效果 console.log 没有输出 也没有任何bug报错
网上查找的资料 1.@click.stop="getLogin" 阻止冒泡 效果:无效 2.@click.native="getLogin" 事件监听 效果:无效 3.层级太深 修改以后 效果:无效
经过各方面查找资料 最终结果是:app.vue中对token有效性判断进行重定向 可能是小程序生命周期所影响 解决方案是 if (!token) { //不存在则跳转至登录页 setTimeout(()=>{ uni.reLaunch({ url: "/pages/login/login", success: () => {
}
})
},500)
}