湖州网站建设官网,wordpress 绑定二级域名,佛山著名网站建设公司,中国建设网官网首页useShareAppMessage
监听用户点击页面内转发按钮#xff08;Button 组件 openTypeshare#xff09;或右上角菜单“转发”按钮的行为#xff0c;并自定义转发内容。等同于 onShareAppMessage 页面生命周期钩子。
使用时#xff0c;必须为页面配置 enableShareAppMessage…
useShareAppMessage
监听用户点击页面内转发按钮Button 组件 openTypeshare或右上角菜单“转发”按钮的行为并自定义转发内容。等同于 onShareAppMessage 页面生命周期钩子。
使用时必须为页面配置 enableShareAppMessage: true。修改配置文件后请重新编译项目
button属性open-typeshareuseShareAppMessage((res) {console.log(res)if (res.from button) {// 来自页面内转发按钮console.log(res.target)}return {title: 请收下我的名片,path: pages/other/fa/index?id${user.id}}
})
被分享的页面
import { useDidShow, getCurrentInstance } from tarojs/taro
const instance getCurrentInstance();useDidShow(() {// 通过页面实例获取IDid.value instance.router?.params?.id;console.log(获取到的ID, id.value);// 进一步处理获取到的IDconst params: any {id: id.value};net.selectMember(params).then((res: any) {//res 为返回数据console.log(res.list[0]);users.name res.list[0].nameusers.position res.list[0].cardPositionusers.phone res.list[0].cardPhoneusers.email res.list[0].cardEmailusers.slogan res.list[0].cardSloganusers.wechat res.list[0].cardWechat}, (err: any) {//err为错误信息请按提示修改console.log(err);});
});