标签:bsp comm lse ram highlight 底部 pos mit cti
函数名 popupVisible,我是把这个方法放到vuex里面, 滚动高度用变量top表示
state: {
pageLoad: !0,
top: 0, // 页面滚动的高度
},
popupVisible(state, newValue) { if (newValue) { // 页面固定 state.top = window.scrollY; console.log("true--state.top", state.top); document.body.style.position = "fixed"; document.body.style.top = -state.top + "px"; } else { // 页面滚动 console.log("false--state.top", state.top); document.body.style.position = ""; document.body.style.top = ""; window.scrollTo(0, state.top); } },
actions 里面commit 该mutations方法:
hidePass({ commit }, params) { // commit对象
commit(‘popupVisible‘, params);
}
vue页面引用:
标签:bsp comm lse ram highlight 底部 pos mit cti
原文地址:https://www.cnblogs.com/demi-guoba/p/11398403.html