mina/pages/food/info.wxml
<import src="../../wxParse/wxParse.wxml" />
<view class="container"> <!--商品轮播图--> <view class="swiper-container"><swiper class="swiper_box" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" bindchange="swiperchange"><block wx:for="{{info.pics}}" wx:key="id"><swiper-item><image src="{{item}}" class="slide-image" width="355" height="150" mode="aspectFit" lazy-load="true"/></swiper-item></block></swiper><view class="dots"><block wx:for="{{info.pics}}" wx:key="unique"><view class="dot{{index == swiperCurrent ? ' active' : ''}}"></view></block></view></view><!--商品基本介绍--><view class="goods-info"><view class="goods-title">{{info.name}}</view><view class="goods-price" style="padding-left:35rpx;">¥ {{info.price}}</view><view class="goods-price" style="color:#999;font-size:24rpx;">购买{{info.total_count}}次</view><view class="goods-price" style="color:#999;font-size:24rpx;">共收到 {{info.comment_count}} 次好评</view><view class="goods-info-fx"><image src='/images/qd.png' /><button open-type="share">分享</button><text>分享有赏</text></view> </view><view class="goods-des-info"><view class="label-title">商品介绍</view><view class="goods-text"><template is="wxParse" data="{{wxParseData:article.nodes}}"/></view></view><!--用户评价--><view class="goods-des-info" style="margin-top:35rpx;" wx:if="{{commentList}}"><view class="label-title" style="border-bottom:1px solid #eee;">大家评价<text style="color:red">({{commentCount}})</text></view><view class="goods-text" style="margin-top:15rpx;border-bottom:1px solid #eee;" wx:for="{{commentList}}"><view style="width:100rpx;float:left;"><image style="width: 100rpx; height: 100rpx;" src="{{item.user.avatar_url}}"></image><view style="text-align:center;width:100rpx;">{{item.score}}</view></view><view style="width:550rpx;float:left;margin-left:35rpx;"><view>{{item.content}}</view><view style="color: #B0B0B0;font-size:24rpx;">{{item.date}}</view></view></view></view><!--底部--><view class="footer-box"><view class="shop-cart-btn" bindtap="goShopCar"><view class="shop-num">({{shopCarNum}})</view><view style='position:absolute;bottom:10rpx;'> 购物车 </view></view><view class="join-shop-cart" bindtap="toAddShopCar">加入购物车</view><view class="now-buy" bindtap="tobuy">立即购买</view></view><!--购买和收藏弹窗--><view class="show-popup" hidden="{{hideShopPopup}}" ><view class="popup-mask" bindtap="closePopupTap"></view><view class="popup-contents"><view class="pop-goods-info"><view class="pop-img-box"><image src="{{info.main_image}}" class="goods-thumbnail"/></view><view class="pop-goods-des"><view class="pop-goods-title">{{info.name}}</view><view class="pop-goods-price">¥ {{info.price}}</view></view><view class="pop-goods-close" bindtap="closePopupTap"></view></view><view class="buy-num-box"><view class="num-label">购买数量</view><view class="num-box"><view class="num-jian {{buyNumber == buyNumMin ? 'hui': ''}}" bindtap="numJianTap">-</view><view class="num-input"><input type="number" value="{{buyNumber}}" disabled/></view><view class="num-jia {{buyNumber== buyNumMax ? 'hui': ''}}" bindtap="numJiaTap">+</view></view></view> <view class="popup-join-btn" wx:if="{{shopType =='addShopCar'}}" bindtap="addShopCar">加入购物车</view><view class="popup-join-btn" wx:if="{{shopType =='tobuy'}}" bindtap="buyNow">立即购买</view> </view></view>
</view>
通过代码
<button open-type="share">分享</button>
进行小程序分享共呢个
转发 | 微信开放文档
通过给 button
组件设置属性 open-type="share"
,可以在用户点击按钮后触发 Page.onShareAppMessage 事件,相关组件:button。
Page(Object object) | 微信开放文档
监听用户点击页面内转发按钮(button 组件 open-type="share"
)或右上角菜单“转发”按钮的行为,并自定义转发内容。