新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)百度小程序教程:web-view中的分享
- web-view 中的分享
- 代碼示例
- 代碼示例
web-view 中的分享
當(dāng)使用 web-view 組件時,用戶從 A(h5) 頁面跳轉(zhuǎn)到了 B(h5) 頁面。此時,用戶在 B 頁面發(fā)起分享,更可能的預(yù)期是分享 B 頁面。但是,默認(rèn)行為將打開 A 頁面。此時,開發(fā)者可以做以下處理,讓分享后打開 B 頁面。

創(chuàng)新互聯(lián)是一家專業(yè)提供仙桃企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計、網(wǎng)站制作、H5建站、小程序制作等業(yè)務(wù)。10年已為仙桃眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。
- 針對小程序框架調(diào)起的分享
代碼示例
在開發(fā)者工具中打開
在開發(fā)者工具中打開
在 WEB IDE 中打開
- SWAN
- JS
Page({data: {webViewUrl: ''},onLoad({webViewUrl}) {webViewUrl && this.setData({webViewUrl});},onShareAppMessage({webViewUrl}) {return {title: '分享回流示例',content: '默認(rèn)會回到分享時的 url',path: `/pages/openShare/openShare?webViewUrl=${encodeURIComponent(webViewUrl)}`};}});
-
針對 H5 頁面通過 openShare API 調(diào)起的分享
-
JS
const webViewUrl = location.href;swan.openShare({title: '智能小程序示例',content: '世界很復(fù)雜,百度更懂你',// 可通過 開發(fā)者平臺 -> 設(shè)置 -> 開發(fā)設(shè)置 中查看appKey: 'y3dTfnWfkx2OXttMEMWlGHoB1KzMogm7',path: `/pages/openShare/openShare?webViewUrl=${encodeURIComponent(webViewUrl)}`});
分享文章:創(chuàng)新互聯(lián)百度小程序教程:web-view中的分享
標(biāo)題來源:http://fisionsoft.com.cn/article/dphpjjc.html


咨詢
建站咨詢
