小程序分享朋友圈

自定义分享朋友圈

<van-action-sheet bind:close="onClose" bind:cancel="onClose" cancel-text="取消" title="分享页面" show="{{ showShare }}">
	<view class="shareBox">
  	<button open-type="share" class="share_box">
    	<!-- <van-icon name="friends" size="30" color="#07c160" /> -->
      <text class="iconfont icon-weixin"></text>
      <view class="share-title">微信好友</view>
    </button>
    <button bind:tap="shareToPoster" class="share_box"> 
    	<!-- <van-icon name="photo" size="30" color="#c79f5d" /> -->
      <text class="iconfont icon-pengyouquan"></text>
      	<view class="share-title">朋友圈</view>
    </button>
	</view>
</van-action-sheet>
<van-dialog closeOnClickOverlay use-slot bind:confirm="saveImage" theme="round-button" confirmButtonText="保存图片到相册" show="{{ isShowShareDialog }}">
  <image src="/static/images/share_img.jpg" class="share-image"></image>
  <canvasdrawer painting="{{painting}}" class="canvasdrawer" bind:getImage="eventGetImage"/>
</van-dialog>
  shareToPoster(){
    // this.loadShare()
    var that=this
    that.setData({
      isShowShareDialog:true
    })
  },
  saveImage(e){
    console.log("保存图片")
    wx.saveImageToPhotosAlbum({
      filePath: "/static/images/share_img.jpg",
      success(res) {
          wx.showToast({
              title: '保存图片成功',
              icon: 'success',
              duration: 2000
          })
      }
  	})
  },

原生方法

注意点

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

// 页面分享设置
onShareTimeline() {
	return {
		title:"分享朋友圈",
		query: id=${this.data.id}',
		imageUrl: this.data.imageUrl
	}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值