Skip to content

Commit 0461274

Browse files
Update WaterFall.vue
1 parent 5ce296b commit 0461274

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/components/WaterFall.vue

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function handleViewerKeyDown(event) {// * 查看器内部 检查是否按下了
151151
let theCycleUpdateInterval
152152
function turnOnCycleUpdate() {
153153
console.log('Turn on cycleUpdate');
154-
theCycleUpdateInterval = window.setInterval(handleLoadMore, 500);
154+
theCycleUpdateInterval = setInterval(handleLoadMore, 500);
155155
}
156156
157157
function tEventListening() { // * 一些乱七八糟的事件的监听
@@ -175,18 +175,12 @@ function tEventListening() { // * 一些乱七八糟的事件的监听
175175
}
176176
}
177177
});
178-
setStore.$subscribe((mutation: any, state) => {
179-
// console.log(mutation, state)
180-
// 监听 章节正则表达式变化,之后重绘书籍
181-
if (mutation.events.key == 'cycleUpdate') {
182-
// console.log(state.cycleUpdate)
183-
if (state.cycleUpdate)
184-
turnOnCycleUpdate()
185-
else
186-
window.clearInterval(theCycleUpdateInterval);
187-
}
178+
watch(() => setStore.cycleUpdate, (newValue, oldValue) => {
179+
if (newValue)
180+
turnOnCycleUpdate()
181+
else
182+
clearInterval(theCycleUpdateInterval);
188183
})
189-
190184
}
191185
192186
// 首次加载

0 commit comments

Comments
 (0)