<template>
	<modal v-model="show" title="查看券码" :showBottom="false">
		<view class="u-p-28">
			<view class="u-flex u-row-center">
				<up-qrcode cid="ex1" :size="104" :val="qrcode"></up-qrcode>
			</view>
			<view class="u-m-t-22 u-flex u-row-center">
				<text>{{ qrcode }}</text>
				<view @click="copyCode">
					<image src="/static/icon/copy.png" class="u-m-l-24 copy"></image>
				</view>
			</view>
		</view>
	</modal>
</template>

<script setup>
	import modal from '@/components/modal.vue'
	const props = defineProps({
		qrcode: {
			type: String,
			default: ''
		}
	})
	const show = defineModel({
		default: false
	})

	function copyCode() {
		uni.setClipboardData({
			data: props.qrcode
		})
	}
</script>

<style lang="scss">
	.copy {
		width: 28rpx;
		height: 28rpx;
	}
</style>