mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-13 00:09:20 +08:00
30 lines
663 B
Vue
30 lines
663 B
Vue
<template>
|
|
<el-icon v-if="!icon"><edit></edit></el-icon>
|
|
<img v-else-if="typeof icon === 'string' && icon.startsWith('http')" :src="icon" />
|
|
<i v-else-if="typeof icon === 'string'" :class="icon"></i>
|
|
<el-icon v-else><component :is="toRaw(icon)"></component></el-icon>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { Component, defineComponent, PropType, toRaw } from 'vue';
|
|
import { Edit } from '@element-plus/icons-vue';
|
|
|
|
export default defineComponent({
|
|
name: 'm-icon',
|
|
|
|
components: { Edit },
|
|
|
|
props: {
|
|
icon: {
|
|
type: [String, Object] as PropType<string | Component>,
|
|
},
|
|
},
|
|
|
|
setup() {
|
|
return {
|
|
toRaw,
|
|
};
|
|
},
|
|
});
|
|
</script>
|