mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-27 02:01:15 +08:00
refactor(components): refactor icon (#5934)
This commit is contained in:
parent
8f15dc1d56
commit
9ac025b5d5
@ -4,36 +4,26 @@
|
||||
</i>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed } from 'vue'
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { isUndefined, addUnit } from '@element-plus/utils'
|
||||
import { useNamespace } from '@element-plus/hooks'
|
||||
import { iconProps } from './icon'
|
||||
|
||||
import type { CSSProperties } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
defineOptions({
|
||||
name: 'ElIcon',
|
||||
inheritAttrs: false,
|
||||
})
|
||||
const props = defineProps(iconProps)
|
||||
const ns = useNamespace('icon')
|
||||
|
||||
props: iconProps,
|
||||
const style = computed<CSSProperties>(() => {
|
||||
if (!props.size && !props.color) return {}
|
||||
|
||||
setup(props) {
|
||||
const ns = useNamespace('icon')
|
||||
|
||||
const style = computed<CSSProperties>(() => {
|
||||
if (!props.size && !props.color) return {}
|
||||
|
||||
return {
|
||||
fontSize: isUndefined(props.size) ? undefined : addUnit(props.size),
|
||||
'--color': props.color,
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
ns,
|
||||
style,
|
||||
}
|
||||
},
|
||||
return {
|
||||
fontSize: isUndefined(props.size) ? undefined : addUnit(props.size),
|
||||
'--color': props.color,
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user