mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-12 13:19:31 +08:00
v1.0.0-beta 源码正式开源
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import util from './util';
|
||||
|
||||
/**
|
||||
* 微信小程序分享功能。
|
||||
*/
|
||||
var cfg = function(){
|
||||
|
||||
let config = {
|
||||
...(this.$tm.vx.store.state.tmVuetify.wxshareConfig_miniMp || {})
|
||||
};
|
||||
if (typeof config.query !== 'object') config.query = {};
|
||||
//获取当前路径。
|
||||
if(!config.path){
|
||||
let cur = getCurrentPages();
|
||||
config.path = cur[cur.length-1].route;
|
||||
|
||||
config.path = (config.path[0]=='/'?'' : '/') + config.path;
|
||||
config.copyLink = config.path;
|
||||
|
||||
}
|
||||
// util.httpUrlAddKey
|
||||
let query = ''
|
||||
for (const key in config.query) {
|
||||
if (config.hasOwnProperty.call(config.query, key)) {
|
||||
const element = config.query[key];
|
||||
query = util.httpUrlAddKey(query,key,element)
|
||||
}
|
||||
}
|
||||
config.copyLink = config.path = config.path+query;
|
||||
config.query = query;
|
||||
|
||||
return config;
|
||||
|
||||
|
||||
}
|
||||
var sharebywx = {
|
||||
onShareAppMessage() {
|
||||
let cg = cfg.call(this)||{};
|
||||
|
||||
return { ...cg}
|
||||
},
|
||||
onShareTimeline() {
|
||||
let cg = cfg.call(this) || {};
|
||||
|
||||
return { ...cg }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default { sharebywx }
|
||||
Reference in New Issue
Block a user