- 是否支持加入购物车或者新增订单接口(指定规格和数量的商品作为参数)
菜谱类内容小程序,使用微信小商店接口搭建商城 有个场景是,用户在我方小程序看了一篇内容,内容关联了多个商品,点击加入购物车,可以选择商品规格和数量,点击加入购物车,希望能有个接口可以下单或者增加到用户购物车,然后再跳转到订单页或者购物车页
2021-02-14 - scroll-into-view与默认页面滚动事件冲突?IOS异常,android正常
在主页面上做横向滚动分页,通过监听touchstart和touchend判断横向滑动动作,通过横向滑动动作切换分页。在开发者平台下和安卓真机下,均能够实现scroll-into-view准确定位到指定的分页,但在IOS真机下,每次scroll-into-view定位到指定分页后会继续执行横向滑动动作,导致分页定位不准。尝试将bindtouch变成catchtouch后,横向定位问题正常,但纵向又无法执行正常滚动了。代码如下,求解!!! js: [代码]touchStart: [代码][代码]function[代码] [代码](e) {[代码][代码] [代码][代码]touchDot = e.touches[0].pageX; [代码][代码]// 获取触摸时的原点[代码][代码] [代码][代码]},[代码][代码] [代码][代码]// 触摸结束事件[代码][代码] [代码][代码]touchEnd: [代码][代码]function[代码] [代码](e) {[代码][代码] [代码][代码]var[代码] [代码]touchMove = e.changedTouches[0].pageX;[代码][代码] [代码][代码]// 向左滑动 [代码][代码] [代码][代码]if[代码] [代码](touchMove - touchDot <= -20) {[代码][代码] [代码][代码]//执行切换页面的方法[代码][代码] [代码][代码]console.log([代码][代码]"向左滑动"[代码][代码]);[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].data.intoview == [代码][代码]'board1'[代码][代码]) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]intoview: [代码][代码]'board2'[代码][代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]else[代码] [代码]if[代码] [代码]([代码][代码]this[代码][代码].data.intoview == [代码][代码]'board2'[代码][代码]) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]intoview: [代码][代码]'board3'[代码][代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]else[代码] [代码]if[代码] [代码]([代码][代码]this[代码][代码].data.intoview == [代码][代码]'board3'[代码][代码]) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]intoview: [代码][代码]'board4'[代码][代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]// 向右滑动 [代码][代码] [代码][代码]else[代码] [代码]if[代码] [代码](touchMove - touchDot >= 20) {[代码][代码] [代码][代码]//执行切换页面的方法[代码][代码] [代码][代码]console.log([代码][代码]"向右滑动"[代码][代码]);[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].data.intoview == [代码][代码]'board2'[代码][代码]) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]intoview: [代码][代码]'board1'[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]else[代码] [代码]if[代码] [代码]([代码][代码]this[代码][代码].data.intoview == [代码][代码]'board3'[代码][代码]) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]intoview: [代码][代码]'board2'[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]else[代码] [代码]if[代码] [代码]([代码][代码]this[代码][代码].data.intoview == [代码][代码]'board4'[代码][代码]) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]intoview: [代码][代码]'board3'[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码]wxml: [代码]<[代码][代码]scroll-view[代码] [代码]class[代码][代码]=[代码][代码]"scroll-board"[代码] [代码]scroll-into-view[代码][代码]=[代码][代码]"{{intoview}}"[代码] [代码]scroll-x [代码][代码]scroll-with-animation[代码][代码]=[代码][代码]'true'[代码] [代码]bind:touchend[代码][代码]=[代码][代码]"touchEnd"[代码] [代码]bind:touchstart[代码][代码]=[代码][代码]"touchStart"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"scroll-content"[代码] [代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]id[代码][代码]=[代码][代码]"board1"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]template[代码] [代码]is[代码][代码]=[代码][代码]"board"[代码] [代码]data[代码][代码]=[代码][代码]"{{board:board1}}"[代码][代码]/>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]id[代码][代码]=[代码][代码]"board2"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]template[代码] [代码]is[代码][代码]=[代码][代码]"board"[代码] [代码]data[代码][代码]=[代码][代码]"{{board:board2}}"[代码][代码]/>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]id[代码][代码]=[代码][代码]"board3"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]template[代码] [代码]is[代码][代码]=[代码][代码]"board"[代码] [代码]data[代码][代码]=[代码][代码]"{{board:board3}}"[代码][代码]/>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]id[代码][代码]=[代码][代码]"board4"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]template[代码] [代码]is[代码][代码]=[代码][代码]"board"[代码] [代码]data[代码][代码]=[代码][代码]"{{board:board4}}"[代码][代码]/>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码]</[代码][代码]scroll-view[代码][代码]>[代码]
2019-10-23