You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
1.2 KiB
1 lines
1.2 KiB
import{Y as e,ab as a,ac as t,y as i,ad as l,ae as r,af as n,ag as s,ah as o}from"./index-c1dbaba4.js";import{w as p}from"./wechat.de0a8524.js";const c=()=>{var c={title:"",link:""},h={};const m=()=>{o()&&p.share(c)},u=async(n={})=>{let s=e();if(a((()=>s.info),(()=>{u(n)})),await(async()=>{o()&&await p.init()})(),n&&n.wechat&&n.weapp){let e=t().params;s.info&&(e.mid=s.info.member_id);let a=[];for(let t in e)a.push(t+"="+e[t]);let r=location.origin+location.pathname+(a.length>0?"?"+a.join("&"):"");c={title:n.wechat.title||"",link:n.wechat.link||r,desc:n.wechat.desc||"",imgUrl:n.wechat.url?i(n.wechat.url):""},m(),h={title:n.weapp.title||"",query:n.weapp.path||"/"+l()+(a.length>0?"?"+a.join("&"):""),imageUrl:n.weapp.url?i(n.weapp.url):""}}else r({route:"/"+l(),params:JSON.stringify(t().params)}).then((e=>{let a=e.data,t=a.wechat;if(t){let e=location.origin+location.pathname+(a.query?"?"+a.query:"");c={link:e,title:t.title,desc:t.desc,imgUrl:t.url?i(t.url):""}}m();let l=a.weapp;l&&(h={query:a.url,title:l.title,imageUrl:l.url?i(l.url):""})}))};return{setShare:u,onShareAppMessage:(e={})=>{n((()=>({...h,...e})))},onShareTimeline:(e={})=>{s((()=>({...h,...e})))}}};export{c as u};
|
|
|