1、下载依赖
npm install --save vue-clipboard3
2、使用
import { ElMessageBox, ElMessage } from 'element-plus';
import router from '@/router';
import { computed, h } from 'vue';
import useStore from '@/store';
const { app } = useStore();
const locale = computed(() => app.language);
import useClipboard from 'vue-clipboard3';
const { toClipboard } = useClipboard();
export const toDownload = (fileNmae: string, excelType?: string) => {
ElMessageBox({
message: h('p', null, [
h('p', null, [
h('span', null, fileNmae),
h(
'span',
{
style: 'padding:5px;background:#409eff;color:#ffffff;border-radius:5px;margin:5px 20px',
onclick: () => {
console.log(fileNmae, '+fileNmae');
toClipboard(fileNmae);
ElMessage({