用织梦怎么修改网站首页商品顺序优化软件有哪些
web/
2025/10/6 6:24:44/
文章来源:
用织梦怎么修改网站首页商品顺序,优化软件有哪些,群晖 wordpress 配置,西宁专业制作网站参考文档
useShareAppMessage
注意
使用时#xff0c;必须为页面配置 enableShareAppMessage: true。#xff08;修改配置文件后请重新编译项目#xff09;当 onShareAppMessage 没有触发时#xff0c;请在页面配置中设置 enableShareAppMessage: true只有定义了此事件处…参考文档
useShareAppMessage
注意
使用时必须为页面配置 enableShareAppMessage: true。修改配置文件后请重新编译项目当 onShareAppMessage 没有触发时请在页面配置中设置 enableShareAppMessage: true只有定义了此事件处理函数右上角菜单才会显示“转发”按钮
1. 全局转发分享
在 src/app.ts 中加入以下配置
import LOGO from ./images/logo.jpginterface ShareType {from: button|menu // 页面内转发按钮 | 右上角转发菜单target: object
}
// ts-ignore
const originPage Page
console.log(originPage, originPage)
// ts-ignore
Page function (pageConfig) {console.log(pageConfig, pageConfig)// 设置全局默认分享const globalShareConfig {onShareAppMessage: (res: ShareType) {console.log(index share, res)if (res.from button) {// 来自页面内转发按钮console.log(res.target)}return {title: 纵横命运之上, // 转发标题 当前小程序名称// path: /pages/index/index, // 转发路径当前页面 path 必须是以 / 开头的完整路径// 使用默认截图 设置转发显示的图片可以使用网络图片 自定义图片路径可以是本地文件路径、代码包文件路径或者网络图片路径。支持 PNG 及 JPG 。显示图片长宽比是 5:4imageUrl: LOGO, // 相对路径图片// imageUrl: https://image-path.png // 网络图片}}}// 将全局分享配置合并到当前页面的配置中const newPageConfig Object.assign({}, globalShareConfig, pageConfig)// 使用原始Page函数创建页面实例return originPage(newPageConfig)
}2. 单个页面自定义转发分享
例如在首页设置自定义转发分享
在 pages/index/index.config.ts 加入相关配置:
export default definePageConfig({navigationBarTitleText: 首页,enableShareAppMessage: true
})在 pages/index/index.vue 自定义转发分享:
script setup langts
import { useShareAppMessage } from tarojs/tarouseShareAppMessage((res) {console.log(share, res)if (res.from button) {// 来自页面内转发按钮console.log(res.target)}return {title: 纵横命运之上,path: /page/index/index}
})
/script
templatebutton open-typeshare分享/button
/template
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/87778.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!