Revert "feat: 微信分享,全局生效"
This reverts commit 15bb8d02f5cfd13b77aca9c966b5ab863220b308.
This commit is contained in:
parent
15bb8d02f5
commit
17ad7a6f6f
@ -40,7 +40,6 @@
|
||||
- [x] 导航栏渐变(微信+h5)
|
||||
- [x] 自定义导航栏顶部机型适配
|
||||
- [x] 微信小程序分享(好友+朋友圈)
|
||||
- [x] 微信小程序分享 - 全局分享
|
||||
- [ ] 微信登录
|
||||
- [ ] 微信一键登录(基于手机号)
|
||||
- [ ] 仿BOSS直聘-个人中心
|
||||
|
23
src/App.vue
23
src/App.vue
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { onLaunch, onShow, onHide, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
|
||||
|
||||
onLaunch(() => {
|
||||
console.log('App Launch')
|
||||
@ -9,25 +9,6 @@ onShow(() => {
|
||||
})
|
||||
onHide(() => {
|
||||
console.log('App Hide')
|
||||
})
|
||||
|
||||
// App.vue里面设置的微信分享对全部页面生效,TODO: 如何拿到每个页面的标题和url呢?
|
||||
|
||||
/** 激活“分享给好友” */
|
||||
onShareAppMessage((options: Page.ShareAppMessageOption): Page.CustomShareContent => {
|
||||
console.log('options:', options)
|
||||
return {
|
||||
title: '自定义分享标题',
|
||||
path: '/pages/index/index?id=xxx',
|
||||
imageUrl:
|
||||
'https://cip-shopping-page-0eysug01066a9e-1302818703.tcloudbaseapp.com/pretty-girl.png',
|
||||
}
|
||||
})
|
||||
/** 激活“分享到朋友圈”, 注意:需要先激活“分享给好友” */
|
||||
onShareTimeline((): Page.ShareTimelineContent => {
|
||||
return {
|
||||
title: '自定义分享标题',
|
||||
query: 'a=1&b=2',
|
||||
}
|
||||
console.log('App Hide')
|
||||
})
|
||||
</script>
|
||||
|
@ -16,6 +16,24 @@
|
||||
|
||||
<script setup lang="ts" name="TestIndex">
|
||||
import { ref } from 'vue'
|
||||
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
||||
/** 激活“分享给好友” */
|
||||
onShareAppMessage((options: Page.ShareAppMessageOption): Page.CustomShareContent => {
|
||||
console.log('options:', options)
|
||||
return {
|
||||
title: '自定义分享标题',
|
||||
path: '/pages/index/index?id=xxx',
|
||||
imageUrl:
|
||||
'https://cip-shopping-page-0eysug01066a9e-1302818703.tcloudbaseapp.com/pretty-girl.png',
|
||||
}
|
||||
})
|
||||
/** 激活“分享到朋友圈”, 注意:需要先激活“分享给好友” */
|
||||
onShareTimeline((): Page.ShareTimelineContent => {
|
||||
return {
|
||||
title: '自定义分享标题',
|
||||
query: 'a=1&b=2',
|
||||
}
|
||||
})
|
||||
|
||||
const list = ref([
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user