Commit c2b7eba5 by 高淑倩

add: canvas err

parent e7d54d43
...@@ -24,7 +24,16 @@ wxService.page({ ...@@ -24,7 +24,16 @@ wxService.page({
}) })
this.getCouponDetail(cardno) this.getCouponDetail(cardno)
}, },
onLoad() {
const {cardno} = this.data
// 条形码
if(cardno){
wxbarcode.barcode('barcode', cardno, 600, 180);
}
},
canvasIdErrorCallback (e) {
console.error(e.detail.errMsg)
},
// 查询单个优惠券 // 查询单个优惠券
getCouponDetail(cardno){ getCouponDetail(cardno){
wx.showLoading({ wx.showLoading({
...@@ -37,7 +46,7 @@ wxService.page({ ...@@ -37,7 +46,7 @@ wxService.page({
this.setData({ this.setData({
codeDetail: data codeDetail: data
}) })
// 条形码 // // 条形码
wxbarcode.barcode('barcode', cardno, 600, 180); wxbarcode.barcode('barcode', cardno, 600, 180);
} else { } else {
wx.hideLoading() wx.hideLoading()
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<image src='/assets/imgs/line.png'></image> <image src='/assets/imgs/line.png'></image>
</view> </view>
<view class="barcode"> <view class="barcode">
<canvas canvas-id="barcode" /> <canvas canvas-id="barcode" binderror="canvasIdErrorCallback"/>
</view> </view>
<view class='bottom-code'>{{cardno}}</view> <view class='bottom-code'>{{cardno}}</view>
</view> </view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment