• 花裤衩's avatar
    Feature/english (#381) · 45fef9b4
    花裤衩 authored
    * perf[navbar]: set langSelect to component && refine errorLog component
    
    * feat[login]:add 18n to login form
    
    * fix[pagination]: fixed when selected page-sizes
    
    * perf[i18n]:dashboard document svg permission
    
    * perf[charts]: perf effect
    
    * perf[i18n]:excel && zip
    
    * perf[i18n]: table && errorLog && theme
    
    * perf[i18n]: components
    
    * perf[i18n]: direct use $t
    
    * perf[i18n]: complex-table
    
    * update README.md
    
    * update README.md :blue_book:
    
    * perf[i18n]: refine code comments
    45fef9b4
clipboard.js 745 Bytes
import Vue from 'vue'
import Clipboard from 'clipboard'

function clipboardSuccess() {
  Vue.prototype.$message({
    message: 'Copy successfully',
    type: 'success',
    duration: 1500
  })
}

function clipboardError() {
  Vue.prototype.$message({
    message: 'Copy failed',
    type: 'error'
  })
}

export default function handleClipboard(text, event) {
  const clipboard = new Clipboard(event.target, {
    text: () => text
  })
  clipboard.on('success', () => {
    clipboardSuccess()
    clipboard.off('error')
    clipboard.off('success')
    clipboard.destroy()
  })
  clipboard.on('error', () => {
    clipboardError()
    clipboard.off('error')
    clipboard.off('success')
    clipboard.destroy()
  })
  clipboard.onClick(event)
}