refine:icon demo add clipboard
This commit is contained in:
parent
4f2f136dd0
commit
065eaa93a2
1 changed files with 11 additions and 2 deletions
|
@ -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">
|
||||
{{`<icon-svg :icon-class="${item}" />`}}
|
||||
{{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>
|
||||
|
|
Loading…
Reference in a new issue