第一次开发web项目的时候遇到:监听浏览器回退,并执行一些方法或函数。
mounted() {
let _this = this;
// 监听浏览器回退
window.addEventListener("popstate", function (e) {
// doing
// _this.$store.commit("setShowLyric", false);
// _this.$store.commit("setShowLyric", false);
// this.alert(_this.showLyric)
});
},
本文分享了初次开发Web项目的经验,关注如何在Vue应用中监听浏览器回退事件,实现如隐藏歌词显示等功能的代码片段。
1583

被折叠的 条评论
为什么被折叠?



