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-14 14:35:03 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2dc125e0298f971666d3c4a7f9f76b19e94ddef6
2dc125e0
1 parent
b284345f
✨ feat(微信分享): 分享标题和描述可配置
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
src/App.vue
src/composables/useShare.js
src/views/client/chooseSchool.vue
src/App.vue
View file @
2dc125e
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-26 23:52:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-14 1
1:46:39
* @LastEditTime: 2022-06-14 1
4:20:03
* @FilePath: /tswj/src/App.vue
* @Description:
-->
...
...
src/composables/useShare.js
View file @
2dc125e
/*
* @Date: 2022-06-13 17:42:32
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-14 1
3:46:20
* @LastEditTime: 2022-06-14 1
4:30:13
* @FilePath: /tswj/src/composables/useShare.js
* @Description: 文件描述
*/
import
wx
from
'weixin-js-sdk'
;
export
const
sharePage
=
()
=>
{
export
const
sharePage
=
(
title
=
'童声无界'
,
desc
=
'共读一本书,传递一份爱。'
)
=>
{
// 分享好友(微信好友或qq好友)
wx
.
updateAppMessageShareData
({
title
:
'童声无界'
,
// 分享标题
desc
:
'共读一本书,传递一份爱。'
,
// 分享描述
title
,
// 分享标题
desc
,
// 分享描述
link
:
location
.
origin
+
location
.
pathname
+
location
.
hash
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
imgUrl
:
'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg'
,
// 分享图标
success
:
function
()
{
...
...
@@ -25,8 +25,8 @@ export const sharePage = () => {
});
// 分享到朋友圈或qq空间
wx
.
updateTimelineShareData
({
title
:
'童声无界'
,
// 分享标题
desc
:
'共读一本书,传递一份爱。'
,
// 分享描述
title
,
// 分享标题
desc
,
// 分享描述
link
:
location
.
origin
+
location
.
pathname
+
location
.
hash
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
imgUrl
:
'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg'
,
// 分享图标
success
:
function
()
{
...
...
@@ -40,8 +40,8 @@ export const sharePage = () => {
});
// 分享到腾讯微博
wx
.
onMenuShareWeibo
({
title
:
'童声无界'
,
// 分享标题
desc
:
'共读一本书,传递一份爱。'
,
// 分享描述
title
,
// 分享标题
desc
,
// 分享描述
link
:
location
.
origin
+
location
.
pathname
+
location
.
hash
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
imgUrl
:
'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg'
,
// 分享图标
success
:
function
()
{
...
...
src/views/client/chooseSchool.vue
View file @
2dc125e
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-04-21 11:21:39
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-14 1
3:46:36
* @LastEditTime: 2022-06-14 1
4:31:39
* @FilePath: /tswj/src/views/client/chooseSchool.vue
* @Description: 选择学校列表
-->
...
...
@@ -23,11 +23,14 @@ import RankingItem from '@/components/RankingItem/index'
import { killPages } from '@/hooks/useKeepAlive'
import { onMounted } from 'vue';
import { sharePage } from '@/composables/useShare.js'
import { useRoute } from 'vue-router'
// const go = useGo()
// 删除所有的 keep-alive 缓存
killPages();
onMounted(() => {
const $route = useRoute();
// TAG:微信分享
sharePage();
})
...
...
Please
register
or
login
to post a comment