feat(金币代理页): 使用第三方的复制功能
This commit is contained in:
parent
d5a1f4b7d9
commit
1c875cb6a2
@ -18,6 +18,7 @@
|
||||
"lint": "eslint . --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vueuse/core": "^13.9.0",
|
||||
"airwallex-payment-elements": "^1.131.0",
|
||||
"pinia": "^3.0.3",
|
||||
"vant": "^4.9.21",
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<div style="font-size: 0.7em; font-weight: 700">Want To Become A Recharge Agency?</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 0.9em;
|
||||
font-size: 0.7em;
|
||||
color: #ff3e13;
|
||||
font-weight: 700;
|
||||
border-bottom: 1px solid #ff3e13;
|
||||
@ -99,7 +99,7 @@
|
||||
>
|
||||
8826602
|
||||
</div>
|
||||
<img :src="images.copyWhite" alt="" width="20%" />
|
||||
<img :src="images.copyWhite" alt="" width="20%" @click="copyPhone('8826602')" />
|
||||
</div>
|
||||
</div>
|
||||
<img src="../../assets/icon/RA.png" alt="" width="25%" style="display: block" />
|
||||
@ -220,7 +220,12 @@
|
||||
<div style="display: flex; gap: 10px; align-items: center">
|
||||
<img :src="images.phone" alt="" width="24px" />
|
||||
<div style="color: #000; font-weight: 600">+86 18709616238</div>
|
||||
<img :src="images.copy" alt="" width="24px" />
|
||||
<img :src="images.copy" alt="" width="24px" @click="copyPhone('+86 18709616238')" />
|
||||
</div>
|
||||
<div style="display: flex; gap: 10px; align-items: center">
|
||||
<img :src="images.phone" alt="" width="24px" />
|
||||
<div style="color: #000; font-weight: 600">+86 18942503069</div>
|
||||
<img :src="images.copy" alt="" width="24px" @click="copyPhone('+86 18942503069')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -231,6 +236,7 @@
|
||||
<script setup>
|
||||
import { isInApp } from '@/utils/appBridge.js'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
import maskLayer from '@/components/MaskLayer.vue'
|
||||
|
||||
//vite动态批量导入图片
|
||||
@ -244,7 +250,7 @@ const images = Object.fromEntries(
|
||||
return [fileName, module.default]
|
||||
})
|
||||
)
|
||||
|
||||
const { copy, isSupported } = useClipboard()
|
||||
const isInAppEnvironment = ref(false) // 检测是否在APP环境中
|
||||
|
||||
const maskLayerShow = ref(false) // 控制遮罩层显示隐藏
|
||||
@ -260,6 +266,20 @@ const defaultAvatarUrl = (e) => {
|
||||
const closedPopup = () => {
|
||||
maskLayerShow.value = false
|
||||
}
|
||||
// 复制到剪贴板(原生方法)
|
||||
const copyPhone = (text) => {
|
||||
if (isSupported.value) {
|
||||
copy(text)
|
||||
} else {
|
||||
// 降级方案
|
||||
const textArea = document.createElement('textarea')
|
||||
textArea.value = text
|
||||
document.body.appendChild(textArea)
|
||||
textArea.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(textArea)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
isInAppEnvironment.value = isInApp()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user