2018-03-26 16:04:04 +08:00
|
|
|
<template>
|
|
|
|
|
<svg
|
2018-11-15 21:18:03 +08:00
|
|
|
v-if="svg || isInnerSvg"
|
2018-03-26 16:04:04 +08:00
|
|
|
class="md-icon"
|
|
|
|
|
:class="[`md-icon-${name}`, size]"
|
2018-09-03 10:55:46 +08:00
|
|
|
:style="{fill: color}"
|
|
|
|
|
@click="$emit('click', $event)"
|
|
|
|
|
>
|
2018-03-26 16:04:04 +08:00
|
|
|
<use :xlink:href="`#${name}`"/>
|
|
|
|
|
</svg>
|
2018-11-15 21:18:03 +08:00
|
|
|
<i
|
|
|
|
|
v-else-if="name"
|
|
|
|
|
class="md-icon"
|
|
|
|
|
:class="[`md-icon-${name}`, size]"
|
|
|
|
|
:style="{color}"
|
|
|
|
|
@click="$emit('click', $event)"
|
|
|
|
|
></i>
|
2018-03-26 16:04:04 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
import loadSprite from './load-spirte'
|
2018-11-15 21:18:03 +08:00
|
|
|
import defaultSvg from './default-svg-list'
|
2018-03-26 16:04:04 +08:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'md-icon',
|
|
|
|
|
|
|
|
|
|
props: {
|
|
|
|
|
name: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
|
|
|
|
size: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'md',
|
|
|
|
|
},
|
|
|
|
|
color: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
2018-10-10 15:03:30 +08:00
|
|
|
svg: {
|
|
|
|
|
type: Boolean,
|
2018-11-15 21:18:03 +08:00
|
|
|
default: false,
|
2018-10-10 15:03:30 +08:00
|
|
|
},
|
2018-03-26 16:04:04 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
loadSprite()
|
|
|
|
|
},
|
2018-11-15 21:18:03 +08:00
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
isInnerSvg() {
|
|
|
|
|
return !!defaultSvg[this.name]
|
|
|
|
|
},
|
|
|
|
|
},
|
2018-03-26 16:04:04 +08:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="stylus">
|
|
|
|
|
.md-icon
|
|
|
|
|
background-size contain
|
|
|
|
|
fill currentColor
|
2018-09-28 17:46:34 +08:00
|
|
|
-webkit-backface-visibility hidden
|
|
|
|
|
transform translateZ(0) scale(1.0, 1.0)
|
2018-10-10 15:03:30 +08:00
|
|
|
font-family "Mand-Mobile-Icon" !important
|
|
|
|
|
font-size 16px
|
|
|
|
|
font-style normal
|
|
|
|
|
-webkit-font-smoothing antialiased
|
|
|
|
|
-moz-osx-font-smoothing grayscale
|
2018-11-30 20:01:20 +08:00
|
|
|
display flex
|
|
|
|
|
align-items center
|
|
|
|
|
justify-content center
|
2018-10-15 18:41:10 +08:00
|
|
|
&:before
|
|
|
|
|
position relative
|
|
|
|
|
z-index 2
|
2018-10-10 15:03:30 +08:00
|
|
|
|
2018-03-26 16:04:04 +08:00
|
|
|
// size
|
|
|
|
|
&.xss
|
|
|
|
|
width icon-size-xxs
|
2018-10-15 18:41:10 +08:00
|
|
|
vertical-height(icon-size-xxs)
|
2018-10-10 15:03:30 +08:00
|
|
|
font-size icon-size-xxs
|
2018-03-26 16:04:04 +08:00
|
|
|
&.xs
|
|
|
|
|
width icon-size-xs
|
2018-10-15 18:41:10 +08:00
|
|
|
vertical-height(icon-size-xs)
|
2018-10-10 15:03:30 +08:00
|
|
|
font-size icon-size-xs
|
2018-03-26 16:04:04 +08:00
|
|
|
&.sm
|
|
|
|
|
width icon-size-sm
|
2018-10-15 18:41:10 +08:00
|
|
|
vertical-height(icon-size-sm)
|
2018-10-10 15:03:30 +08:00
|
|
|
font-size icon-size-sm
|
2018-03-26 16:04:04 +08:00
|
|
|
&.md
|
|
|
|
|
width icon-size-md
|
2018-10-15 18:41:10 +08:00
|
|
|
vertical-height(icon-size-md)
|
2018-10-10 15:03:30 +08:00
|
|
|
font-size icon-size-md
|
2018-03-26 16:04:04 +08:00
|
|
|
&.lg
|
|
|
|
|
width icon-size-lg
|
2018-10-15 18:41:10 +08:00
|
|
|
vertical-height(icon-size-lg)
|
2018-10-10 15:03:30 +08:00
|
|
|
font-size icon-size-lg
|
|
|
|
|
|
|
|
|
|
// name
|
2018-11-15 21:18:03 +08:00
|
|
|
.md-icon-rectangle:before
|
|
|
|
|
content "\e900"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-invisible:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e601"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-visible:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e602"
|
|
|
|
|
.md-icon-right:before
|
|
|
|
|
content "\e905"
|
|
|
|
|
.md-icon-wrong:before
|
|
|
|
|
content "\e906"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-info:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e605"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-service:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e606"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-edit:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e607"
|
|
|
|
|
.md-icon-refresh:before
|
|
|
|
|
content "\e901"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-question:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e608"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-setting:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e609"
|
|
|
|
|
.md-icon-wait:before
|
|
|
|
|
content "\e902"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-check:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e904"
|
|
|
|
|
.md-icon-check-disabled:before
|
|
|
|
|
content "\e903"
|
|
|
|
|
.md-icon-checked:before, .md-icon-success:before
|
2018-12-03 19:07:37 +08:00
|
|
|
content "\e908"
|
2018-11-15 21:18:03 +08:00
|
|
|
.md-icon-clear:before, .md-icon-fail:before
|
|
|
|
|
content "\e60e"
|
|
|
|
|
.md-icon-info-solid:before
|
|
|
|
|
content "\e907"
|
|
|
|
|
.md-icon-warn:before
|
|
|
|
|
content "\e60b"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-security:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e60f"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-rmb:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e610"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-scan:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e611"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-share:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e612"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-back:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e613"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-card-bag:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e614"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-message:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e615"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-order:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e616"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-balance:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e617"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-coupon:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e618"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-sort:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e619"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-address-book:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e61a"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-mobile-phone:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e61b"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-home:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e61c"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-discovery:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e61d"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-calendar:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e61e"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-user:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e61f"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-time:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e620"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-search:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e621"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-switch:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e622"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-camera:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e623"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-clock:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e624"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-profession:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e625"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-delete:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e626"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-id-card:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e627"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-filter:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e628"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-location:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e629"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-authentication:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e62a"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-motor-vehicle:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e62b"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-phone:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e62c"
|
2018-10-10 15:03:30 +08:00
|
|
|
.md-icon-volumn:before
|
2018-11-15 21:18:03 +08:00
|
|
|
content "\e62d"
|
|
|
|
|
.md-icon-arrow-left:before
|
|
|
|
|
content "\e603"
|
|
|
|
|
.md-icon-arrow-right:before
|
|
|
|
|
content "\e630"
|
|
|
|
|
.md-icon-arrow-up:before
|
|
|
|
|
content "\e633"
|
|
|
|
|
.md-icon-arrow-down:before
|
|
|
|
|
content "\e634"
|
|
|
|
|
.md-icon-close:before
|
|
|
|
|
content "\e604"
|
2018-10-10 15:03:30 +08:00
|
|
|
|
|
|
|
|
@font-face
|
|
|
|
|
font-family Mand-Mobile-Icon
|
|
|
|
|
/* chrome、firefox、opera、Safari, Android, iOS 4.2+ */
|
2018-11-15 23:34:22 +08:00
|
|
|
/* Version is required */
|
2018-12-03 19:07:37 +08:00
|
|
|
src url("//manhattan.didistatic.com/static/manhattan/mand-mobile/icon/2.0.2/iconfont.ttf") format("truetype")
|
2018-10-10 15:03:30 +08:00
|
|
|
font-style normal
|
|
|
|
|
font-weight normal
|
2018-09-28 17:46:34 +08:00
|
|
|
</style>
|