| 12345678910111213141516171819202122232425262728293031323334353637 |
- // 创建全局mixin
- export default {
- onLoad() {
- // 开启分享功能
- uni.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- })
- },
-
- onShareAppMessage() {
- return {
- title: this.shareTitle || '默认分享标题',
- path: this.sharePath || '/pages/index/index',
- imageUrl: this.shareImage || '/static/share.png'
- }
- },
-
- onShareTimeline() {
- return {
- title: this.timelineTitle || '默认朋友圈标题',
- query: this.timelineQuery || '',
- imageUrl: this.timelineImage || '/static/share.png'
- }
- },
-
- data() {
- return {
- shareTitle: '',
- sharePath: '',
- shareImage: '',
- timelineTitle: '',
- timelineQuery: '',
- timelineImage: ''
- }
- }
- }
|