<script setup>

import copy from "copy-to-clipboard"
import {inject} from "vue";

const utils = inject("$utils")

const props = defineProps({
	"text": {
		type: String,
		default: ""
	},
	tooltip: {
		type: String,
		default: ""
	}
})

const execCopy = function () {
	copy(props.text)
	utils.successToast("已复制到剪切板")
}

</script>

<template>
	<a href="" v-tooltip.bottom="tooltip ? tooltip : '点击拷贝到剪切板'" @click.prevent="execCopy"><i class="pi pi-copy small"></i></a>
</template>

<style scoped>
</style>
