Skip to content

Commit 4a1e45a

Browse files
committed
优化页面滚动事件
1 parent 6f4bf3b commit 4a1e45a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/views/Home.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<div ref="banner" class="banner content-item-block">
44
<div class="video-wrapper">
55
<video
6+
ref="video"
67
class="video"
78
preload="auto"
89
muted
@@ -230,7 +231,8 @@ export default {
230231
this.$router.push({ name: "products", params: item });
231232
}
232233
},
233-
mounted() {
234+
activated() {
235+
this.$refs.video.play();
234236
const rootVm = this.$root;
235237
rootVm.$emit(
236238
"home-scrolling",
@@ -241,7 +243,7 @@ export default {
241243
rootVm.$emit("home-scrolling", ...args);
242244
});
243245
},
244-
destroyed() {
246+
deactivated() {
245247
this.unwatch();
246248
}
247249
};

0 commit comments

Comments
 (0)