hookehuyr

✨ feat(微信分享): 分享标题和描述可配置

......@@ -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 11:46:39
* @LastEditTime: 2022-06-14 14:20:03
* @FilePath: /tswj/src/App.vue
* @Description:
-->
......
/*
* @Date: 2022-06-13 17:42:32
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-14 13:46:20
* @LastEditTime: 2022-06-14 14: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 () {
......
......@@ -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 13:46:36
* @LastEditTime: 2022-06-14 14: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();
})
......