小程序 转发 功能

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")或右上角菜单“转发”按钮的行为,并自定义转发内容。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xinzheng新政

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值