import Clipboard from 'clipboard';
import {  Message } from 'element-ui'


export function handleClipboard(text,event, currentTarget){

    const clipboard =  new Clipboard('.tag',{
        text:()=>text
    })
    clipboard.on('success',() => {
      Message({
        message: '复制成功',
        showClose: true,
        type: 'success'
      })
      clipboard.destroy()
    })
    clipboard.on('error',() =>{
      Message({
        message: '复制失败',
        showClose: true,
        type: 'error'
      })
      clipboard.destroy()
    })
    clipboard.onClick({currentTarget})
}
