Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_initScroll () {
this.menuScroll = new BScroll(this.$refs.menuRef, {
click: true
})
this.foodsScroll = new BScroll(this.$refs.foodsRef, {
click: true,
probeType: 3
})
this.foodsScroll.on('scroll', pos => {
this.scrollY = Math.abs(Math.floor(pos.y))
// console.log(this.scrollY)
})
},
// 计算右侧每一大项的高度
initScroll() {
let { probeType, click, scrollX, listenScroll } = this.props
this.scroll = new BScroll(this.wrapper, {
probeType,
click,
scrollX,
listenScroll
})
// 是否派发滚动到底部事件,用于上拉加载
if (this.props.pullupFunc) {
this.scroll.on('scrollEnd', () => {
// 滚动到底部
if (this.scroll.y <= this.scroll.maxScrollY + 50) {
this.props.pullupFunc()
}
})
}
_initSubTitleScroll () {
let contentWrapperWidth = 0;
let el = this.$refs.subTitle;
for (let i = 0; i < el.length; i++) {
contentWrapperWidth += el[i].clientWidth;
}
// 给ul设置值
this.$refs.ulContent.style.width = contentWrapperWidth + 'px';
if (!this.scroll) {
this.scroll = new BScroll('.subTitleWrapper', {
startX: 0,
click: true,
scrollX: true,
scrollY: false,
eventPassthrough: "vertical",
});
} else {
this.scroll.refresh();
}
},
//
_initScroll() {
if(!this.scroll) {
this.scroll = new BScroll(this.$refs.labelWrapper, {
scrollX: true,
click: true
})
} else {
this.scroll.refresh()
}
},
// 计算所有的 label 的宽度和
_initScroll () {
if (!this.productImageScroll) {
this.$refs.imageWrapper.style.width = (this.$refs.subWrapper.length * 60) + 'px';
this.productImageScroll = new BScroll(this.$refs.productImageWrapper, {
probeType: 3,
startX: 0,
click: true,
scrollX: true,
});
} else {
this.productImageScroll.refresh();
}
},
// 2.返回到上个界面
this.$nextTick(() => {
this.scrollCityBody = new BScroll(this.$refs.cityBody, {
probeType: 3,
click: true
})
console.log('aa')
this.scrollCityBody.on('scroll', (pos) => {
console.log(pos.x + '~' + pos.y)
})
this.scrollCityBody.scrollTo(0, 0)
})
} else {
createWheel (wheelWrapper, i) {
if (!this.wheels[i]) {
const wheel = this.wheels[i] = new BScroll(wheelWrapper.children[i], {
wheel: {
selectedIndex: 0,
rotate: 25
},
bounceTime: 500,
swipeTime: 1800
})
wheel.on('scrollEnd', () => {
this.cascadePickerChange(i)
})
} else {
this.wheels[i].refresh()
}
return this.wheels[i]
},
initScroll() {
this.menuScroll = new BScroll(this.$refs.menuScroll, {
click: true
})
this.foodScroll = new BScroll(this.$refs.foodScroll, {
probeType: 3,
click: true
})
//foodScroll监听事件
this.foodScroll.on("scroll", (pos) => {
this.scrollY = Math.abs(pos.y)
})
},
calculateHeight() {
_initScroll() {
if (!this.scroll) {
this.scroll = new BScroll(this.$refs.seller, {
click: true
});
} else {
this.scroll.refresh();
}
},
_initPics() {
componentDidMount() {
this.setState({
showFlag : true,
selectType : ALL,
onlyContent : true
})
if (!this.scroll) {
this.scroll = new BScroll(this.refs.food, {
click: true
});
} else {
this.scroll.refresh();
}
}
hide() {