add icon tips

This commit is contained in:
Pan 2017-08-29 18:04:48 +08:00 committed by 花裤衩
parent 90fd4328b7
commit c182a119e1
2 changed files with 9 additions and 3 deletions

View file

@ -2,11 +2,11 @@ import Vue from 'vue'
import IconSvg from '@/components/Icon-svg'// svg组件 import IconSvg from '@/components/Icon-svg'// svg组件
import generateIconsView from '@/views/svg-icons/generateIconsView.js'// just for views/icons , you can delete it import generateIconsView from '@/views/svg-icons/generateIconsView.js'// just for views/icons , you can delete it
// register globally // register globally
Vue.component('icon-svg', IconSvg) Vue.component('icon-svg', IconSvg)
const requireAll = requireContext => requireContext.keys().map(requireContext) const requireAll = requireContext => requireContext.keys().map(requireContext)
const req = require.context('./svg', false, /\.svg$/) const req = require.context('./svg', false, /\.svg$/)
const iconMap = requireAll(req) const iconMap = requireAll(req)
console.log(generateIconsView)
generateIconsView.generate(iconMap) // just for views/icons , you can delete it generateIconsView.generate(iconMap) // just for views/icons , you can delete it

View file

@ -2,7 +2,12 @@
<div class="icons-container"> <div class="icons-container">
<div class="icons-wrapper"> <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'>
<el-tooltip placement="top" effect="light">
<div slot="content">
{{`&lt;icon-svg :icon-class=&quot;${item}&quot; /&gt;`}}
</div>
<icon-svg :icon-class="item" /> <icon-svg :icon-class="item" />
</el-tooltip>
<span>{{item}}</span> <span>{{item}}</span>
</div> </div>
</div> </div>
@ -42,6 +47,7 @@ export default {
float: left; float: left;
font-size: 40px; font-size: 40px;
color: #666; color: #666;
cursor: pointer;
} }
span { span {
display: block; display: block;