|
|
@ -19,12 +19,21 @@ export default {
|
|
|
|
return this.$refs.scrollContainer.$refs.wrap
|
|
|
|
return this.$refs.scrollContainer.$refs.wrap
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
this.scrollWrapper.addEventListener('scroll', this.emitScroll, true)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
|
|
|
this.scrollWrapper.removeEventListener('scroll', this.emitScroll)
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
handleScroll(e) {
|
|
|
|
handleScroll(e) {
|
|
|
|
const eventDelta = e.wheelDelta || -e.deltaY * 40
|
|
|
|
const eventDelta = e.wheelDelta || -e.deltaY * 40
|
|
|
|
const $scrollWrapper = this.scrollWrapper
|
|
|
|
const $scrollWrapper = this.scrollWrapper
|
|
|
|
$scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4
|
|
|
|
$scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
emitScroll() {
|
|
|
|
|
|
|
|
this.$emit('scroll')
|
|
|
|
|
|
|
|
},
|
|
|
|
moveToTarget(currentTag) {
|
|
|
|
moveToTarget(currentTag) {
|
|
|
|
const $container = this.$refs.scrollContainer.$el
|
|
|
|
const $container = this.$refs.scrollContainer.$el
|
|
|
|
const $containerWidth = $container.offsetWidth
|
|
|
|
const $containerWidth = $container.offsetWidth
|
|
|
|