更新:登录功能
This commit is contained in:
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>
|
||||
Reference in New Issue
Block a user