1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <template>
- <svg :class="svgClass" aria-hidden="true">
- <use :xlink:href="iconName"/>
- </svg>
- </template>
- <script>
- export default {
- name: 'SvgIcon',
- props: {
- iconClass: {
- type: String,
- required: true
- },
- className: {
- type: String,
- default: ''
- }
- },
- computed: {
- iconName() {
- return `#icon-${this.iconClass}`
- },
- svgClass() {
- if (this.className) {
- return 'svg-icon ' + this.className
- } else {
- return 'svg-icon'
- }
- }
- }
- }
- </script>
- <style scoped>
- .svg-icon {
- width: 2em;
- height: 2em;
- vertical-align: -0.15em;
- fill: #F0F2F5;
- overflow: hidden;
- vertical-align: middle;
- }
- </style>
|