更新:登录功能
This commit is contained in:
1230
uni_modules/wot-design-uni/components/wd-icon/index.scss
Normal file
1230
uni_modules/wot-design-uni/components/wd-icon/index.scss
Normal file
File diff suppressed because it is too large
Load Diff
21
uni_modules/wot-design-uni/components/wd-icon/types.ts
Normal file
21
uni_modules/wot-design-uni/components/wd-icon/types.ts
Normal 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')
|
||||
}
|
||||
53
uni_modules/wot-design-uni/components/wd-icon/wd-icon.vue
Normal file
53
uni_modules/wot-design-uni/components/wd-icon/wd-icon.vue
Normal 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>
|
||||
BIN
uni_modules/wot-design-uni/components/wd-icon/wd-icons.ttf
Normal file
BIN
uni_modules/wot-design-uni/components/wd-icon/wd-icons.ttf
Normal file
Binary file not shown.
Reference in New Issue
Block a user