/**
|
* 作者:c.y
|
* 文件说明: 微信分享的额外添加参数的判断
|
* created by c.k on 2018/2/27
|
*
|
*/
|
|
export default {
|
// 判断地址栏出现微信自己加的参数问题
|
getUrlQuestionMark () {
|
let url = window.location.href;
|
let matchResult = url.match(/\?/g);
|
// 如果地址栏中,出现了两个问号的话,那么是微信在分享添加了参数
|
// 如果地址栏中,出现了form=,那么就是微信分享添加的参数
|
// 需要注意,不要在我们的路由地址上添加,from=这个参数,这个是为了区分微信
|
return (matchResult ? matchResult.length >= 2 : false) || (/from=/.test(url));
|
},
|
// 把地址栏的中微信追加的参数去掉,返回我们自己项目的地址
|
getRightProjectUrl () {
|
let location = window.location;
|
return location.origin + location.pathname + location.hash;
|
}
|
};
|