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 13:49:28 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b284345f8388c24e4303919d940a50b8c49be895
b284345f
1 parent
1e4b7463
✨ feat(分享模块): 只能用字面数据,不能引用 不然不生效
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
23 deletions
src/composables/useShare.js
src/views/client/chooseSchool.vue
src/composables/useShare.js
View file @
b284345
/*
* @Date: 2022-06-13 17:42:32
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-14 1
1:43:19
* @LastEditTime: 2022-06-14 1
3:46:20
* @FilePath: /tswj/src/composables/useShare.js
* @Description: 文件描述
*/
import
wx
from
'weixin-js-sdk'
;
const
shareData
=
{
title
:
'童声无界'
,
// 分享标题
desc
:
'共读一本书,传递一份爱。'
,
// 分享描述
link
:
location
.
origin
+
location
.
pathname
+
location
.
hash
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
imgUrl
:
'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg'
,
// 分享图标
success
:
function
()
{
// 用户确认分享后执行的回调函数
console
.
warn
(
'分享成功'
);
},
cancel
:
function
()
{
// 用户取消分享后执行的回调函数
console
.
warn
(
'分享已取消'
);
}
}
export
const
sharePage
=
()
=>
{
// 分享好友(微信好友或qq好友)
wx
.
updateAppMessageShareData
(
shareData
);
wx
.
updateAppMessageShareData
({
title
:
'童声无界'
,
// 分享标题
desc
:
'共读一本书,传递一份爱。'
,
// 分享描述
link
:
location
.
origin
+
location
.
pathname
+
location
.
hash
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
imgUrl
:
'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg'
,
// 分享图标
success
:
function
()
{
// 用户确认分享后执行的回调函数
console
.
warn
(
'分享成功'
);
},
cancel
:
function
()
{
// 用户取消分享后执行的回调函数
console
.
warn
(
'分享已取消'
);
}
});
// 分享到朋友圈或qq空间
wx
.
updateTimelineShareData
(
shareData
);
wx
.
updateTimelineShareData
({
title
:
'童声无界'
,
// 分享标题
desc
:
'共读一本书,传递一份爱。'
,
// 分享描述
link
:
location
.
origin
+
location
.
pathname
+
location
.
hash
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
imgUrl
:
'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg'
,
// 分享图标
success
:
function
()
{
// 用户确认分享后执行的回调函数
console
.
warn
(
'分享成功'
);
},
cancel
:
function
()
{
// 用户取消分享后执行的回调函数
console
.
warn
(
'分享已取消'
);
}
});
// 分享到腾讯微博
wx
.
onMenuShareWeibo
(
shareData
);
wx
.
onMenuShareWeibo
({
title
:
'童声无界'
,
// 分享标题
desc
:
'共读一本书,传递一份爱。'
,
// 分享描述
link
:
location
.
origin
+
location
.
pathname
+
location
.
hash
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
imgUrl
:
'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg'
,
// 分享图标
success
:
function
()
{
// 用户确认分享后执行的回调函数
console
.
warn
(
'分享成功'
);
},
cancel
:
function
()
{
// 用户取消分享后执行的回调函数
console
.
warn
(
'分享已取消'
);
}
});
}
...
...
src/views/client/chooseSchool.vue
View file @
b284345
...
...
@@ -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
1:48:09
* @LastEditTime: 2022-06-14 1
3:46:36
* @FilePath: /tswj/src/views/client/chooseSchool.vue
* @Description: 选择学校列表
-->
...
...
@@ -21,14 +21,16 @@
import RankingItem from '@/components/RankingItem/index'
// import { useGo } from '@/hooks/useGo'
import { killPages } from '@/hooks/useKeepAlive'
//
import { onMounted } from 'vue';
import { onMounted } from 'vue';
import { sharePage } from '@/composables/useShare.js'
// const go = useGo()
// 删除所有的 keep-alive 缓存
killPages();
// TAG:微信分享
sharePage();
onMounted(() => {
// TAG:微信分享
sharePage();
})
</script>
<script>
...
...
Please
register
or
login
to post a comment