Files
qncV3uni-app/src/components/QRcode.vue
2026-02-06 17:34:00 +08:00

42 lines
1.3 KiB
Vue

<template>
<wd-popup v-model="visible" position="bottom" :safe-area-inset-bottom="true" custom-style="border-radius: 16px 16px 0 0;">
<view class="p-4 pb-6 bg-white">
<view class="text-center font-semibold text-lg mb-3">{{ title }}</view>
<view class="rounded-lg bg-gray-100 p-3 mb-3 break-all text-sm text-gray-700">{{ fullLink || '暂无链接' }}</view>
<view class="flex gap-3">
<wd-button type="primary" block @click="copyUrl">复制链接</wd-button>
<wd-button type="default" block @click="visible = false">关闭</wd-button>
</view>
</view>
</wd-popup>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
show: { type: Boolean, default: false },
fullLink: { type: String, default: '' },
title: { type: String, default: '推广链接' },
})
const emit = defineEmits(['update:show'])
const visible = computed({
get: () => props.show,
set: (v) => emit('update:show', v),
})
function copyUrl() {
if (!props.fullLink) {
uni.showToast({ title: '暂无链接', icon: 'none' })
return
}
uni.setClipboardData({
data: props.fullLink,
success: () => uni.showToast({ title: '已复制到剪贴板', icon: 'success' }),
fail: () => uni.showToast({ title: '复制失败', icon: 'none' }),
})
}
</script>