这一版本优化了很多

This commit is contained in:
王利强
2026-06-03 10:16:37 +08:00
parent 8046316216
commit 2af9f1fd59
954 changed files with 58194 additions and 1609 deletions

1230
node_modules/wot-design-uni/components/wd-icon/index.scss generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
import { baseProps, makeRequiredProp, makeStringProp, numericProp } from '../common/props'
export const iconProps = {
...baseProps,
/**
* 使用的图标名字,可以使用链接图片
*/
name: makeRequiredProp(String),
/**
* 图标的颜色
*/
color: String,
/**
* 图标的字体大小
*/
size: numericProp,
/**
* 类名前缀,用于使用自定义图标
*/
classPrefix: makeStringProp('wd-icon')
}

View File

@@ -0,0 +1,53 @@
<template>
<view @click="handleClick" :class="rootClass" :style="rootStyle">
<image v-if="isImage" class="wd-icon__image" :src="name"></image>
</view>
</template>
<script lang="ts">
export default {
name: 'wd-icon',
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: 'shared'
}
}
</script>
<script lang="ts" setup>
import { computed, type CSSProperties } from 'vue'
import { addUnit, isDef, objToStyle } from '../common/util'
import { iconProps } from './types'
const props = defineProps(iconProps)
const emit = defineEmits(['click', 'touch'])
const isImage = computed(() => {
return isDef(props.name) && props.name.includes('/')
})
const rootClass = computed(() => {
const prefix = props.classPrefix
return `${prefix} ${props.customClass} ${isImage.value ? 'wd-icon--image' : prefix + '-' + props.name}`
})
const rootStyle = computed(() => {
const style: CSSProperties = {}
if (props.color) {
style['color'] = props.color
}
if (props.size) {
style['font-size'] = addUnit(props.size)
}
return `${objToStyle(style)} ${props.customStyle}`
})
function handleClick(event: any) {
emit('click', event)
}
</script>
<style lang="scss" scoped>
@import './index.scss';
</style>

Binary file not shown.