refine:icon demo add clipboard

This commit is contained in:
Pan 2017-09-27 10:13:25 +08:00 committed by 花裤衩
parent 4f2f136dd0
commit 065eaa93a2

View file

@ -1,10 +1,10 @@
<template>
<div class="icons-container">
<div class="icons-wrapper">
<div v-for='item of iconsMap' :key='item' class='icon-item'>
<div v-for='item of iconsMap' :key='item' class='icon-item' @click='handleClipboard(generateIconCode(item),$event)'>
<el-tooltip placement="top" effect="light">
<div slot="content">
{{`&lt;icon-svg :icon-class=&quot;${item}&quot; /&gt;`}}
{{generateIconCode(item)}}
</div>
<icon-svg :icon-class="item" />
</el-tooltip>
@ -16,6 +16,7 @@
<script>
import icons from './generateIconsView'
import clipboard from '@/utils/clipboard' // use clipboard directly
export default {
data() {
@ -28,6 +29,14 @@ export default {
return i.default.id.split('-')[1]
})
this.iconsMap = iconsMap
},
methods: {
generateIconCode(symbol) {
return `<icon-svg :icon-class="${symbol}" />`
},
handleClipboard(text, event) {
clipboard(text, event)
}
}
}
</script>