diff --git a/package/component/src/component/splitPanel/index.less b/package/component/src/component/splitPanel/index.less index 4b7869ab..3d9d5d59 100644 --- a/package/component/src/component/splitPanel/index.less +++ b/package/component/src/component/splitPanel/index.less @@ -4,7 +4,6 @@ position: relative; .lay-split-panel-item { height: 100%; - flex-grow: 1; border: 1px #eeeeee solid; } .lay-split-panel-item-move { diff --git a/package/component/src/component/splitPanel/index.vue b/package/component/src/component/splitPanel/index.vue index c9e0c82c..5cc37d5d 100644 --- a/package/component/src/component/splitPanel/index.vue +++ b/package/component/src/component/splitPanel/index.vue @@ -1,14 +1,15 @@ diff --git a/package/component/src/component/splitPanelItem/index.vue b/package/component/src/component/splitPanelItem/index.vue index fd5cb42a..b7f855bc 100644 --- a/package/component/src/component/splitPanelItem/index.vue +++ b/package/component/src/component/splitPanelItem/index.vue @@ -14,12 +14,11 @@ import { onBeforeUnmount, reactive, withDefaults, - watch, } from "vue"; import type { ComputedRef } from "vue"; -export interface LayStepItemProps { +interface LayStepItemProps { space?: number; } @@ -34,11 +33,6 @@ const setIndex = (val: number) => { index.value = val; }; -const mousedown = (event: any) => { - moveStatus.value = true; - parents.moveChange(event, true); -}; - const mouseup = (event: any) => { moveStatus.value = false; }; @@ -47,6 +41,34 @@ const stepsCount = computed(() => { return parents.steps.value.length; }); +const initSpace = (parentSpace: any, key: string) => { + const childList = Array.from(parentElement.value.children); + childList.forEach((item: any, index: number) => { + if (index === 0 || index % 2 === 0) { + item.style.flexBasis = (item[key] / parentSpace) * 100 + "%"; + item.style.flexGrow = 0; + } + }); +}; + +const mousedown = (event: any) => { + let parentSpace = 0; + if (!isVertical.value) { + parentSpace = parentElement.value.offsetWidth; + initSpace(parentSpace, "offsetWidth"); + } else { + parentSpace = parentElement.value.offsetHeight; + initSpace(parentSpace, "offsetHeight"); + } + + moveStatus.value = true; + parents.moveChange(event, true, isVertical.value); +}; + +const parentElement = computed(() => { + return parents.target.value; +}); + const isVertical = computed(() => { return parents.props.vertical; }); @@ -63,9 +85,8 @@ const isStart: ComputedRef = computed(() => { const stepItemState = reactive({ itemId: computed(() => currentInstance?.uid), setIndex, - width: [], + space: props.space, }); - parents.steps.value = [...parents.steps.value, stepItemState]; onMounted(() => {}); @@ -85,16 +106,17 @@ onBeforeUnmount(() => { v-on="{ mousedown: mousedown, mouseup: mouseup }" >
diff --git a/package/component/src/component/table/TableRow.vue b/package/component/src/component/table/TableRow.vue index 7a215e1c..c03ce9c1 100644 --- a/package/component/src/component/table/TableRow.vue +++ b/package/component/src/component/table/TableRow.vue @@ -128,7 +128,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { if (column.fixed == "left") { var left = 0; for (var i = 0; i < columnIndex; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left") { left = left + props.columns[i]?.width.replace("px", ""); } } @@ -136,7 +136,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { } else { var right = 0; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right") { right = right + props.columns[i]?.width.replace("px", ""); } } @@ -150,7 +150,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => { if (column.fixed == "left") { var left = true; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left") { left = false; } } @@ -158,14 +158,14 @@ const renderFixedClassName = (column: any, columnIndex: number) => { } else { var right = true; for (var i = 0; i < columnIndex; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right") { right = false; } } return `layui-table-fixed-right-first`; } } -} +};