W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
解釋:頁(yè)面的事件處理函數(shù),用戶點(diǎn)擊右上角轉(zhuǎn)發(fā)。
Web 態(tài)說明:Web 態(tài)小程序暫不支持。
詳情參見頁(yè)面相關(guān)事件處理函數(shù)。
<view class="wrap">
<view class="card-area">
<view class="tip-week">發(fā)送內(nèi)容(以下字段可自由適配)</view>
<view class="list-area">
<view class="list-item-key-4">標(biāo)題</view>
<input class="list-item-value" bindinput="dataInput" data-type="title" value="{{shareData.title}}" type="text" placeholder="請(qǐng)輸入key" />
</view>
<view class="list-area">
<view class="list-item-key-4">內(nèi)容</view>
<input class="list-item-value" bindinput="dataInput" data-type="content" value="{{shareData.content}}" type="text" placeholder="請(qǐng)輸入key" />
</view>
<view class="list-area">
<view class="list-item-key-4">跳轉(zhuǎn)頁(yè)面</view>
<input class="list-item-value" bindinput="dataInput" data-type="path" value="{{shareData.path}}" type="text" placeholder="請(qǐng)輸入key" />
</view>
<button type="primary" open-type="share" hover-stop-propagation="true">點(diǎn)擊打開分享面板</button>
<view class="tip-week">點(diǎn)擊右上角菜單或者點(diǎn)擊button轉(zhuǎn)發(fā)給好友</view>
</view>
</view>
Page({
data: {
shareData: {
title: '小程序標(biāo)題',
content: '世界很復(fù)雜,百度更懂你',
path: 'api/onShareAppMessage/onShareAppMessage'
}
},
onShareAppMessage() {
this.data.shareData.path += '?fr=shareApp';
return this.data.shareData;
},
dataInput(e) {
let type = e.currentTarget.dataset.type;
let dataInput = e.detail.value;
switch (type) {
case 'title': {
let title = 'shareData.title';
this.setData({
[title]: dataInput
});
break;
}
case 'content': {
let content = 'shareData.content';
this.setData({
[content]: dataInput
});
break;
}
case 'path': {
let path = 'shareData.path';
this.setData({
[path]: dataInput
});
break;
}
}
}
});
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: