add cart toast

wechat_user_type
Ge Hao 8 years ago
parent 73ab46e9bd
commit d43f907fdc
  1. 6
      pages/show_product/show_product.js
  2. 4
      pages/show_product/show_product.wxml

@ -3,6 +3,7 @@ const product = require('../../utils/product.js')
Page({
data: {
toastAddProduct: true,
title: '',
id: 0,
address: '',
@ -41,6 +42,7 @@ Page({
product.setAttribute('quantity', this.data.quantity)
cartItems.data.push(product)
}
this.setData({ toastAddProduct:false });
wx.setStorage({
key: 'cartItems',
@ -52,6 +54,10 @@ Page({
this.setData({'quantity': e.detail.value})
},
toastChange: function(){
this.setData({ toastAddProduct:true });
},
// 立即购买
formSubmit: function(e) {
e.detail.value['sku'] = e.target.dataset['sku']

@ -21,4 +21,8 @@
</form>
</view>
<toast hidden="{{toastAddProduct}}" bindchange="toastChange" duration="1200">
<text style="font-size:28rpx">成功加入购物车</text>
</toast>
</view>

Loading…
Cancel
Save