feature[Icons]: add element-ui icons demo (#1865)
This commit is contained in:
parent
342b7b428a
commit
8f45dbe328
|
@ -0,0 +1 @@
|
||||||
|
["info","error","success","warning","question","back","arrow-left","arrow-down","arrow-right","arrow-up","caret-left","caret-bottom","caret-top","caret-right","d-arrow-left","d-arrow-right","minus","plus","remove","circle-plus","remove-outline","circle-plus-outline","close","check","circle-close","circle-check","circle-close-outline","circle-check-outline","zoom-out","zoom-in","d-caret","sort","sort-down","sort-up","tickets","document","goods","sold-out","news","message","date","printer","time","bell","mobile-phone","service","view","menu","more","more-outline","star-on","star-off","location","location-outline","phone","phone-outline","picture","picture-outline","delete","search","edit","edit-outline","rank","refresh","share","setting","upload","upload2","download","loading"]
|
|
@ -4,7 +4,8 @@
|
||||||
<a href="https://panjiachen.github.io/vue-element-admin-site/guide/advanced/icon.html" target="_blank">Add and use
|
<a href="https://panjiachen.github.io/vue-element-admin-site/guide/advanced/icon.html" target="_blank">Add and use
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<div class="icons-wrapper">
|
<el-tabs type="border-card">
|
||||||
|
<el-tab-pane label="Icons">
|
||||||
<div v-for="item of iconsMap" :key="item" @click="handleClipboard(generateIconCode(item),$event)">
|
<div v-for="item of iconsMap" :key="item" @click="handleClipboard(generateIconCode(item),$event)">
|
||||||
<el-tooltip placement="top">
|
<el-tooltip placement="top">
|
||||||
<div slot="content">
|
<div slot="content">
|
||||||
|
@ -16,25 +17,44 @@
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="Element-UI Icons">
|
||||||
|
<div v-for="item of elementIcons" :key="item" @click="handleClipboard(generateElementIconCode(item),$event)">
|
||||||
|
<el-tooltip placement="top">
|
||||||
|
<div slot="content">
|
||||||
|
{{ generateElementIconCode(item) }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="icon-item">
|
||||||
|
<i :class="'el-icon-' + item" />
|
||||||
|
<span>{{ item }}</span>
|
||||||
|
</div>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import icons from './requireIcons'
|
|
||||||
import clipboard from '@/utils/clipboard'
|
import clipboard from '@/utils/clipboard'
|
||||||
|
import icons from './requireIcons'
|
||||||
|
import elementIcons from './element-icon.json'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Icons',
|
name: 'Icons',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
iconsMap: icons
|
iconsMap: icons,
|
||||||
|
elementIcons: elementIcons
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
generateIconCode(symbol) {
|
generateIconCode(symbol) {
|
||||||
return `<svg-icon icon-class="${symbol}" />`
|
return `<svg-icon icon-class="${symbol}" />`
|
||||||
},
|
},
|
||||||
|
generateElementIconCode(symbol) {
|
||||||
|
return `<i class="el-icon-${symbol}" />`
|
||||||
|
},
|
||||||
handleClipboard(text, event) {
|
handleClipboard(text, event) {
|
||||||
clipboard(text, event)
|
clipboard(text, event)
|
||||||
}
|
}
|
||||||
|
@ -46,25 +66,25 @@ export default {
|
||||||
.icons-container {
|
.icons-container {
|
||||||
margin: 10px 20px 0;
|
margin: 10px 20px 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
.icons-wrapper {
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
.icon-item {
|
.icon-item {
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
height: 110px;
|
height: 85px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 110px;
|
width: 100px;
|
||||||
float: left;
|
float: left;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
color: #24292e;
|
color: #24292e;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 24px;
|
font-size: 16px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
.disabled{
|
|
||||||
|
.disabled {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
const req = require.context('../../icons/svg', false, /\.svg$/)
|
const req = require.context('../../icons/svg', false, /\.svg$/)
|
||||||
const requireAll = requireContext => requireContext.keys()
|
const requireAll = requireContext => requireContext.keys()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue