// a页面
const init = () => {
setTimeout(() => {
// 调转b页面
router.push('/b' + location.search)
}, 100)
}
onMounted(() => {
nextTick(() => {
init()
});
});从b页面后退之后却不会返回到a页面?这是什么原因?
// a页面
const init = () => {
setTimeout(() => {
// 调转b页面
router.push('/b' + location.search)
}, 100)
}
onMounted(() => {
nextTick(() => {
init()
});
});从b页面后退之后却不会返回到a页面?这是什么原因?
11 回答1.3k 阅读
3 回答966 阅读✓ 已解决
2 回答961 阅读✓ 已解决
3 回答953 阅读✓ 已解决
2 回答649 阅读
3 回答974 阅读
3 回答973 阅读
你在a页面这么写,从b页面返回到a页面后,重新执行onMounted内的函数不是又跳回b页面了吗?
如果a页面没有使用keepalive缓存,那么每次返回a页面都会重新执行onMounted生命周期函数