Commit 67432de9 authored by sixiaofeng's avatar sixiaofeng

app-icon组件修改

parent 7dcc873b
<template> <template>
<fragment> <fragment>
<div v-if="type==='png'" :class="className" @click="handleClick"> <div v-if="type==='png'" :class="className" @click="handleClick">
<img :src="path ? path : require(`@/assets/icons/${iconName}.png`)" class="object-cover object-center " > <img :src="getImagePath" class="object-cover object-center " >
</div> </div>
<svg v-else aria-hidden="true" :height="size" :width="size" :fill="color" @click="handleClick"> <svg v-else aria-hidden="true" :height="size" :width="size" :fill="color" @click="handleClick">
<use :xlink:href="'#'+name" ></use> <use :xlink:href="'#'+name" ></use>
...@@ -35,6 +35,14 @@ export default Vue.extend({ ...@@ -35,6 +35,14 @@ export default Vue.extend({
iconName: String, iconName: String,
className: String, className: String,
}, },
computed: {
getImagePath() {
if (this.path) {
return this.path
}
return require(`@/assets/icons/${this.iconName}.png`)
}
},
methods: { methods: {
handleClick() { handleClick() {
this.$emit('click') this.$emit('click')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment