通过微信小程序官方文档,我们发现只能通过
官方提供button的组件来完成转发功能。
那么如何通过show-actionSheet组件来实现转发功能。
官方文档:
微信小程序使用show-actionSheet组件实现转发功能
如图所示:

微信小程序使用show-actionSheet组件实现转发功能

微信小程序使用show-actionSheet组件实现转发功能

代码实现:

其中wxml文件


<action-sheet  hidden="{{actionSheetHidden}}" bindchange="listenerActionSheet" wx:for-index="idx">
   <action-sheet-item>
         <button open-type="share">分享给微信好友</button>
   </action-sheet-item>
<view wx:for="{{itemList}}" wx:for-item="item" wx:for-index="idx" >
   <action-sheet-item bindtap='operate' id='{{idx}}'>{{item.name}}</action-sheet-item>
</view>
   <action-sheet-cancel>取消</action-sheet-cancel>
</action-sheet>

js文件

 listenerButton: function() {
    this.setData({
      actionSheetHidden: !this.data.actionSheetHidden
    });
  },
  listenerActionSheet: function() {

    this.setData({
      actionSheetHidden: !this.data.actionSheetHidden,
    })
  },

page data

 data: {
    actionSheetHidden: true,
    itemList: [{
      name: "下载视频"
    }, {
      name: '举报用户'
    }],
  },

相关文章:

  • 2021-11-30
  • 2022-01-01
  • 2022-12-23
  • 2021-12-15
  • 2021-07-12
  • 2021-07-18
  • 2021-05-06
  • 2022-12-23
猜你喜欢
  • 2021-07-16
  • 2022-01-15
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2021-07-07
相关资源
相似解决方案