vaneditor
Version:
``` 移动端ui框架统一用uView,css扩展语言用scss,全局数据管理vuex,统一样式主体风格颜色定义/src/uni.scss ```
39 lines • 1.82 kB
JavaScript
/**
*
* @param {标题} title 默认畅游金华+路由name
* @param {描述} desc 默认金华本地旅游生活体验,新鲜好玩,惊喜不断!
* @param {链接地址} link 默认当前页面地址
* @param {图片} imgUrl 默认畅游金华微信logo图片
*/
import store from '@/store'
var jweixin = require('jweixin-module')
function share (title, desc, link, imgUrl) {
let url = window.location.hash
if (/personalCenter/.test(url)) {
title = '畅游金华本地旅游生活体验平台'
}
jweixin.ready(function () {
jweixin.onMenuShareAppMessage({
title: (title || store.state.wxShare.storeName), // 分享标题
desc: (desc || store.state.wxShare.desc), // 分享描述
link:'http://' + window.location.host + window.location.pathname + '#' + (link || '/pages/index/index'), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: imgUrl || store.state.wxShare.img, // 分享图标
type: '', // 分享类型,music、video或link,不填默认为link
success: function () {
// 用户点击了分享后执行的回调函数
}
})
jweixin.onMenuShareTimeline({
title: (title || '畅游金华 ' + document.title), // 分享标题
link: 'http://' + window.location.host + window.location.pathname + '#' + (link || '/pages/index/index'), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: imgUrl || store.state.wxShare.img, // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
})
})
}
export default share