欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序?qū)崿F(xiàn)頁面分享onShareAppMessage

 更新時(shí)間:2019年08月12日 10:31:11   作者:意外金喜  
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)頁面分享onShareAppMessage,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

效果


js

let app = getApp();
Page({
 data: {
  img: "/images/1.jpg"
 },
 onLoad() {
 },
 showShareMenu() {
  wx.showShareMenu();
  console.log("顯示了當(dāng)前頁面的轉(zhuǎn)發(fā)按鈕");
 },
 hideShareMenu() {
  wx.hideShareMenu();
  console.log("隱藏了當(dāng)前頁面的轉(zhuǎn)發(fā)按鈕");
 },
 onShareAppMessage: (res) => {
  if (res.from === 'button') {
   console.log("來自頁面內(nèi)轉(zhuǎn)發(fā)按鈕");
   console.log(res.target);
  }
  else {
   console.log("來自右上角轉(zhuǎn)發(fā)菜單")
  }
  return {
   title: '妹子圖片',
   path: '/pages/share/share?id=123',
   imageUrl: "/images/1.jpg",
   success: (res) => {
    console.log("轉(zhuǎn)發(fā)成功", res);
   },
   fail: (res) => {
    console.log("轉(zhuǎn)發(fā)失敗", res);
   }
  }
 }
})

html

<view class="view">
 <image class="cover-9" src="{{img}}" bindtap="img"></image>
 <view class="window-1">
  <button type="default" id="open" bindtap="showShareMenu">開啟分享</button>
  <button type="warn" id="close" bindtap="hideShareMenu">關(guān)閉分享</button>
 </view>
 <button type="primary" open-type="share" data-name="pageShare" id="share">點(diǎn)擊分享</button>
</view>

css

page{
 height: 100%;
}
.view{
 width: 100%;
 height: 100%;
}
.window-1{
 display: flex;
 flex-direction: row;
 margin: 20rpx 0;
}
.cover-9{
 width: 688rpx;
 height: 75%;
 margin: 0 30rpx;
 border:2rpx solid;
 border-radius:5px; 
}
button{
 margin: 0 10rpx;
 width: 100%;
}
#share{
 width: 730rpx;
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論