Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
U
uni-pdtravel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
panyongping
uni-pdtravel
Commits
a0143ecc
Commit
a0143ecc
authored
Jul 30, 2021
by
zhoucong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加分享功能
parent
68fb5dbf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
share.js
common/share.js
+44
-0
No files found.
common/share.js
0 → 100644
View file @
a0143ecc
export
default
{
//微信小程序分享功能
data
(){
return
{
//设置默认的分享参数
share
:{
title
:
'vlog'
,
path
:
'/pages/index/index'
,
imageUrl
:
''
,
desc
:
''
,
content
:
''
}
}
},
onLoad
(){
wx
.
showShareMenu
({
withShareTicket
:
true
,
menus
:[
"shareAppMessage"
,
"shareTimeline"
]
})
},
onShareAppMessage
(
res
)
{
//发送给朋友
// 此处的openid为分享者的部分信息,需要传递给其他人
let
openid
=
uni
.
getStorageSync
(
'openid'
);
if
(
openid
)
{
return
{
title
:
'胖丁旅游'
,
type
:
0
,
path
:
'/pages/index/index?id='
+
openid
,
summary
:
""
,
imageUrl
:
"https://58d.oss-cn-hangzhou.aliyuncs.com/goods/ttg_1596073788000.png"
}
}
},
onShareTimeline
(
res
)
{
//分享到朋友圈
let
openid
=
uni
.
getStorageSync
(
'openid'
);
if
(
openid
)
{
return
{
title
:
'胖丁旅游'
,
type
:
0
,
query
:
'id='
+
openid
,
summary
:
""
,
imageUrl
:
"https://58d.oss-cn-hangzhou.aliyuncs.com/goods/ttg_1596073788000.png"
}
}
},
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment