Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
jgdl
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-07-07 16:03:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4fafb41c91180dc196a483f0b6d5f1379f41c0c2
4fafb41c
1 parent
0bff44e7
refactor(分享功能): 移除分享成功和失败的回调处理逻辑
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
58 deletions
src/pages/index/index.vue
src/pages/productDetail/index.vue
src/pages/index/index.vue
View file @
4fafb41
<!--
* @Date: 2025-06-28 10:33:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-07-07 1
5:34:42
* @LastEditTime: 2025-07-07 1
6:02:49
* @FilePath: /jgdl/src/pages/index/index.vue
* @Description: 捡个电驴首页
-->
...
...
@@ -397,34 +397,6 @@ useShareAppMessage(() => {
title: '捡个电驴-分享给好友', // 默认是小程序的名称(可以写slogan等)
path: `pages/index/index`, // 默认是当前页面,必须是以'/'开头的完整路径
imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
success: function (res) {
// 转发成功之后的回调
if (res.errMsg == 'shareAppMessage:ok') {
Taro.showToast({
title: '分享成功',
icon: 'success'
})
}
},
fail: function () {
// 转发失败之后的回调
if (res.errMsg == 'shareAppMessage:fail cancel') {
// 用户取消转发
Taro.showToast({
title: '分享取消',
icon: 'none'
})
} else if (res.errMsg == 'shareAppMessage:fail') {
// 转发失败,其中 detail message 为详细失败信息
Taro.showToast({
title: '分享失败',
icon: 'none'
})
}
},
complete: function () {
// 转发结束之后的回调(转发成不成功都会执行)
}
}
// 来自页面内的按钮的转发
// if (options.from == 'button') {
...
...
src/pages/productDetail/index.vue
View file @
4fafb41
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-07-07 1
5:51:00
* @LastEditTime: 2025-07-07 1
6:03:15
* @FilePath: /jgdl/src/pages/productDetail/index.vue
* @Description: 商品详情页
-->
...
...
@@ -494,34 +494,6 @@ useShareAppMessage(() => {
title: product.value.name, // 默认是小程序的名称(可以写slogan等)
path: `pages/productDetail/index?id=${params.id}`, // 默认是当前页面,必须是以'/'开头的完整路径
imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
success: function (res) {
// 转发成功之后的回调
if (res.errMsg == 'shareAppMessage:ok') {
Taro.showToast({
title: '分享成功',
icon: 'success'
})
}
},
fail: function () {
// 转发失败之后的回调
if (res.errMsg == 'shareAppMessage:fail cancel') {
// 用户取消转发
Taro.showToast({
title: '分享取消',
icon: 'none'
})
} else if (res.errMsg == 'shareAppMessage:fail') {
// 转发失败,其中 detail message 为详细失败信息
Taro.showToast({
title: '分享失败',
icon: 'none'
})
}
},
complete: function () {
// 转发结束之后的回调(转发成不成功都会执行)
}
}
// 来自页面内的按钮的转发
// if (options.from == 'button') {
...
...
Please
register
or
login
to post a comment