11
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user