Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
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
2022-06-13 20:09:05 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5e4c7442ab18373f3cbb96e6b74c9c4b31d23795
5e4c7442
1 parent
598f8d90
✨ feat: 微信分享功能优化导入
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
21 deletions
src/composables/useShare.js
src/views/client/bookDetail.vue
src/views/client/chooseSchool.vue
src/composables/useShare.js
0 → 100644
View file @
5e4c744
/*
* @Date: 2022-06-13 17:42:32
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-13 17:42:58
* @FilePath: /tswj/src/composables/useShare.js
* @Description: 文件描述
*/
import
wx
from
'weixin-js-sdk'
import
{
useRoute
}
from
'vue-router'
export
const
sharePage
=
()
=>
{
const
$route
=
useRoute
();
wx
.
updateAppMessageShareData
({
title
:
'童声无界'
,
// 分享标题
desc
:
$route
.
meta
.
title
,
// 分享描述
link
:
location
.
href
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
imgUrl
:
location
.
origin
+
location
.
pathname
+
'images/weixin_logo.png'
,
// 分享图标
success
:
function
()
{
// 用户确认分享后执行的回调函数
console
.
warn
(
'分享成功'
);
},
cancel
:
function
()
{
// 用户取消分享后执行的回调函数
console
.
warn
(
'分享已取消'
);
}
})
}
src/views/client/bookDetail.vue
View file @
5e4c744
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-21 09:35:14
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-13 1
5:13:42
* @LastEditTime: 2022-06-13 1
9:23:54
* @FilePath: /tswj/src/views/client/bookDetail.vue
* @Description:
-->
...
...
src/views/client/chooseSchool.vue
View file @
5e4c744
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-04-21 11:21:39
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-13 17:
24:04
* @LastEditTime: 2022-06-13 17:
45:03
* @FilePath: /tswj/src/views/client/chooseSchool.vue
* @Description: 选择学校列表
-->
...
...
@@ -22,30 +22,13 @@ import RankingItem from '@/components/RankingItem/index'
// import { useGo } from '@/hooks/useGo'
import { killPages } from '@/hooks/useKeepAlive'
// import { onMounted } from 'vue';
import wx from 'weixin-js-sdk'
import { useRoute } from 'vue-router'
// import { wxJsAPI } from '@/api/wx/config'
import { sharePage } from '@/composables/useShare.js'
// const go = useGo()
// 删除所有的 keep-alive 缓存
killPages();
// TAG:微信分享
// const $route = useRoute();
// wx.updateAppMessageShareData({
// title: '童声无界', // 分享标题
// desc: $route.meta.title, // 分享描述
// link: location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
// imgUrl: location.origin + location.pathname + 'images/weixin_logo.png', // 分享图标
// success: function () {
// // 用户确认分享后执行的回调函数
// console.warn('分享成功');
// },
// cancel: function () {
// // 用户取消分享后执行的回调函数
// console.warn('分享已取消');
// }
// })
sharePage();
</script>
<script>
...
...
Please
register
or
login
to post a comment