vr-uniapp/src/components/common/custom-module/model-icon/index.vue

54 lines
1.6 KiB
Vue
Raw Normal View History

2024-09-23 08:29:44 +00:00
<template>
2024-09-23 09:37:24 +00:00
<div class="img-outer re oh flex-row" :style="com_style">
2024-09-24 06:10:45 +00:00
<icon :name="form.icon_class" :color="form.icon_color" :size="form.icon_size + ''"></icon>
2024-09-23 08:29:44 +00:00
</div>
</template>
<script setup lang="ts">
import { radius_computer, padding_computer, gradient_handle } from '@/utils';
2024-09-23 08:29:44 +00:00
const props = defineProps({
value: {
type: Object,
default: () => {
return {};
},
required: true
},
sourceList: {
type: Object,
default: () => {
return {};
}
},
isPercentage: {
type: Boolean,
default: false
}
});
// 用于页面判断显示
const form = reactive(props.value);
const com_style = computed(() => {
let style = `${ set_count() } ${ gradient_handle(form.color_list, form.direction) } ${ radius_computer(form.bg_radius) };transform: rotate(${form.icon_rotate}deg);${ padding_computer(form.icon_padding) };`;
2024-09-23 08:29:44 +00:00
if (form.border_show == '1') {
2024-09-23 09:37:24 +00:00
style += `border: ${form.border_size}px ${form.border_style} ${form.border_color};box-sizing: border-box;`;
2024-09-23 08:29:44 +00:00
}
2024-09-23 09:31:38 +00:00
if (form.icon_location == 'center') {
style += `justify-content: center;`;
} else if (form.icon_location == 'left') {
style += `justify-content: flex-start;`;
} else if (form.icon_location == 'right') {
style += `justify-content: flex-end;`;
2024-09-23 08:29:44 +00:00
}
return style;
});
const set_count = () => {
if (props.isPercentage) {
return '';
} else {
return `width: ${ form.com_width }px; height: ${ form.com_height }px;`;
}
};
</script>
<style lang="scss" scoped>
</style>