Home
Sign Up
Sign In
›
Vue.js
Advertisement
V2EX
›
Vue.js
浏览器点击后退,怎样更新 Vue 的组件状态?
xia0ta0
·
Aug 23, 2016
· 10954 views
This topic created in 3616 days ago, the information mentioned may be changed or developed.
现在网站的首页有一个用户消息提示,用户点击后会查看消息。但是当用户后退到首页,消息提示还在。只有刷新页面才能消除。
请问在哪个生命周期里进行设置?
后退
首页
Vue
点击
6 replies
•
2016-08-24 09:34:14 +08:00
1
des
Aug 23, 2016 via Android
1
监听 popstate 事件,然后主动刷新?
2
shyling
Aug 23, 2016
1
在 route:{
data:{初始化消息提示为隐藏状态}
}
3
airyland
Aug 23, 2016
1
点击后为什么不清除掉。。
4
xia0ta0
OP
Aug 23, 2016
@
des
感觉有点不 Vue ...
@
shyling
现在是在一个 component 里, route 方法好像不起作用
@
airyland
想找到一个通用的浏览器后退,页面状态刷新方案
5
shyling
Aug 23, 2016
@
xia0ta0
试试 ready ,不然就在外部 component 传 not show 的 prop , vuex 什么的咯
6
xia0ta0
OP
Aug 24, 2016
@
shyling
嗯,看来要放到 store 了
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
2800 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: d3e9c8b8 · 38ms ·
UTC 15:08
·
PVG 23:08
·
LAX 08:08
·
JFK 11:08
♥ Do have faith in what you're doing.
❯