feat:【mall】diy editor 的 divider 组件

This commit is contained in:
YunaiV
2025-10-28 18:49:26 +08:00
parent 11ac616fd1
commit 328ad78a2c
4 changed files with 19 additions and 27 deletions

View File

@@ -1,7 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
// TODO @AI改成 El 风格而不是iel- 风格;
import { computed } from 'vue'; import { computed } from 'vue';
import { ElColorPicker, ElInput } from 'element-plus';
import { PREDEFINE_COLORS } from '@vben/constants'; import { PREDEFINE_COLORS } from '@vben/constants';
/** 颜色输入框 */ /** 颜色输入框 */
@@ -27,11 +28,11 @@ const color = computed({
</script> </script>
<template> <template>
<el-input v-model="color"> <ElInput v-model="color">
<template #prepend> <template #prepend>
<el-color-picker v-model="color" :predefine="PREDEFINE_COLORS" /> <ElColorPicker v-model="color" :predefine="PREDEFINE_COLORS" />
</template> </template>
</el-input> </ElInput>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -2,19 +2,14 @@ import type { DiyComponent } from '../../../util';
/** 分割线属性 */ /** 分割线属性 */
export interface DividerProperty { export interface DividerProperty {
// 高度 height: number; // 高度
height: number; lineWidth: number; // 线宽
// 线宽 paddingType: 'horizontal' | 'none'; // 边距类型
lineWidth: number; lineColor: string; // 颜色
// 边距类型 borderType: 'dashed' | 'dotted' | 'none' | 'solid'; // 类型
paddingType: 'horizontal' | 'none';
// 颜色
lineColor: string;
// 类型
borderType: 'dashed' | 'dotted' | 'none' | 'solid';
} }
// 定义组件 /** 定义组件 */
export const component = { export const component = {
id: 'Divider', id: 'Divider',
name: '分割线', name: '分割线',

View File

@@ -25,5 +25,3 @@ defineProps<{ property: DividerProperty }>();
></div> ></div>
</div> </div>
</template> </template>
<style scoped lang="scss"></style>

View File

@@ -13,15 +13,15 @@ import {
ElTooltip, ElTooltip,
} from 'element-plus'; } from 'element-plus';
import { InputWithColor as ColorInput } from '#/views/mall/promotion/components'; import { ColorInput } from '#/views/mall/promotion/components';
// /** 导航栏属性面板 */
defineOptions({ name: 'DividerProperty' }); defineOptions({ name: 'DividerProperty' });
const props = defineProps<{ modelValue: DividerProperty }>();
const emit = defineEmits(['update:modelValue']);
const formData = useVModel(props, 'modelValue', emit);
// 线 const props = defineProps<{ modelValue: DividerProperty }>();
const emit = defineEmits(['update:modelValue']);
const BORDER_TYPES = [ const BORDER_TYPES = [
{ {
icon: 'vaadin:line-h', icon: 'vaadin:line-h',
@@ -43,7 +43,8 @@ const BORDER_TYPES = [
text: '无', text: '无',
type: 'none', type: 'none',
}, },
]; ]; // 线
const formData = useVModel(props, 'modelValue', emit);
</script> </script>
<template> <template>
@@ -96,11 +97,8 @@ const BORDER_TYPES = [
</ElRadioGroup> </ElRadioGroup>
</ElFormItem> </ElFormItem>
<ElFormItem label="颜色"> <ElFormItem label="颜色">
<!-- 分割线颜色 -->
<ColorInput v-model="formData.lineColor" /> <ColorInput v-model="formData.lineColor" />
</ElFormItem> </ElFormItem>
</template> </template>
</ElForm> </ElForm>
</template> </template>
<style scoped lang="scss"></style>