mirror of
https://gitee.com/h_mo/uniapp-vue3-vite-ts-template
synced 2025-04-05 19:41:44 +08:00
feat: FontAwesomeIcon click emit
This commit is contained in:
parent
e587fb5be6
commit
f8866ece2a
@ -12,6 +12,10 @@
|
||||
import { FontAwesomeIconProps } from '@/components/FontAwesomeIcon/props';
|
||||
const props = defineProps(FontAwesomeIconProps);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'click'): void;
|
||||
}>();
|
||||
|
||||
const singleBeat = props.beat && !props.fade;
|
||||
const singleFade = !props.beat && props.fade;
|
||||
const BeatFade = props.beat && props.fade;
|
||||
@ -108,15 +112,19 @@
|
||||
color: props.color,
|
||||
'font-size': props.size ? `${props.size}rpx` : false,
|
||||
});
|
||||
|
||||
const onClick = () => {
|
||||
emit('click');
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<template v-if="props.stack">
|
||||
<view class="icon-wrap" :class="wrapClassObject" :style="wrapStyleObject">
|
||||
<view @click="onClick" class="icon-wrap" :class="wrapClassObject" :style="wrapStyleObject">
|
||||
<slot :stack="props.stack"></slot>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="icon-wrap" :class="wrapClassObject" :style="wrapStyleObject">
|
||||
<view @click="onClick" class="icon-wrap" :class="wrapClassObject" :style="wrapStyleObject">
|
||||
<text class="icon" :style="iconStyleObject" :class="iconClassObject" />
|
||||
</view>
|
||||
</template>
|
||||
|
@ -7,7 +7,7 @@ export const FontAwesomeIconProps = {
|
||||
name: {
|
||||
type: String,
|
||||
default: 'default',
|
||||
required: true,
|
||||
// required: true,
|
||||
},
|
||||
/** icon 风格
|
||||
* 不同风格对应不同的css, 使用时请加载相应的css
|
||||
|
Loading…
x
Reference in New Issue
Block a user