解决微信领取支付宝立减金,ios复制链接不成功

This commit is contained in:
Apple 2022-06-17 14:23:34 +08:00
parent ea04e3afba
commit cd4f7c1a34
1 changed files with 15 additions and 3 deletions

View File

@ -47,6 +47,14 @@
<span @click="knowFn">知道了</span> <span @click="knowFn">知道了</span>
</div> </div>
</div> </div>
<!-- 复制提示 -->
<div class="popboxshow" v-if="copyshow" :class="copyshow?'active':''">
<div class="tip">
<p>请点击下方[复制]按钮,复制链接到浏览器打开!</p>
<span @click="copyFn">复制</span>
</div>
</div>
<div class="couponShow"> <div class="couponShow">
<span> <span>
<img @click="backgoodsFn" v-if="backAble" class="backIcon" <img @click="backgoodsFn" v-if="backAble" class="backIcon"
@ -101,6 +109,8 @@
plaflam: 1, //支付宝 plaflam: 1, //支付宝
promtshow: false, promtshow: false,
promttip: "警告提示", promttip: "警告提示",
copyshow:false,//解决ios必须触发按钮复制
copyLink:'',//存储链接
popboxshow: false, popboxshow: false,
maskshow: false, maskshow: false,
bindClick:false, bindClick:false,
@ -212,7 +222,9 @@
let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境 let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境
if (ua.match(/MicroMessenger/i) == "micromessenger") { if (ua.match(/MicroMessenger/i) == "micromessenger") {
//复制链接地址,提醒去浏览器打开 //复制链接地址,提醒去浏览器打开
this.copyTextToClipboard(link); this.copyLink=link;
this.copyshow=true;
this.maskshow=true;
} else { } else {
//唤起支付宝 //唤起支付宝
window.location.replace(link); window.location.replace(link);
@ -239,9 +251,9 @@
}, 3000); }, 3000);
}, },
//复制文本 //复制文本
copyTextToClipboard(text) { copyFn() {
var textArea = document.createElement("textarea"); var textArea = document.createElement("textarea");
textArea.value = text; textArea.value = this.copyLink;
document.body.appendChild(textArea); document.body.appendChild(textArea);
textArea.select(); textArea.select();
document.execCommand("copy"); document.execCommand("copy");