This commit is contained in:
clay
2022-01-21 17:44:37 +08:00
parent d6374440d2
commit 2c4b597942
26 changed files with 777 additions and 138 deletions

View File

@@ -63,12 +63,41 @@ export default {
return {
width: document.documentElement.clientWidth,
imageUrl:null,
iftop: false,
timer : true,
}
},
beforeDestroy() { //及时释放
window.removeEventListener('scroll', this.handleScroll)
},
created() {
getConfig("sist_bg").then(res=>{
this.imageUrl = res.data
})
},
mounted() {
window.addEventListener('scroll', this.handleScroll)
const that = this
window.onresize = () => {
return (() => {
//这里写要操作的函数
window.screenWidth = document.body.clientWidth
that.width = window.screenWidth>992
})()
}
},
methods: {
handleScroll() {
this.iftop = window.pageYOffset > 400
console.log(window.pageYOffset)
this.$emit("input", window.pageYOffset)
},
backTop() {
window.scrollTo({top: 0, behavior: 'smooth',})
}
}
}
</script>