Commit ce2e5526 by Jaxon

style(descriptions): 统一代码格式并优化布局样式

重新格式化模板代码,统一缩进与属性排列顺序
将label容器从span调整为div
为.value类添加flex-basis: 0以优化flex布局表现
1 parent df522694
<template> <template>
<el-row class="description-wrapper" <el-row align="top"
style="width:100%;overflow:hidden;flex-wrap: wrap" class="description-wrapper"
type="flex" style="width:100%;overflow:hidden;flex-wrap: wrap"
:gutter="gutter" type="flex"
align="top"> :gutter="gutter">
<template v-for="item in getSchema"> <template v-for="item in getSchema">
<el-col v-if="!isHideSchemaItem(item)" <el-col v-if="!isHideSchemaItem(item)"
:key="item._key" :key="item._key"
:span="item.col || 12"> :span="item.col || 12">
<template v-if="item.divider"> <template v-if="item.divider">
<el-divider v-bind="item.dividerProps"></el-divider> <el-divider v-bind="item.dividerProps"></el-divider>
</template>
<template v-else>
<slot :name="item.slot || item.name ">
<div class="form-item" :style="item.itemStyle || {}">
<span class="label text-hide"
:title="item.label"
:style="{ width: item.labelWidth || '150px' }">
<slot :name="`${item.slot || item.name}-label`">
{{ item.label }}{{ item.hideColon ? "" : ":" }}
</slot>
</span>
<span class="value">
<el-tooltip :disabled="!item.tooltip"
v-bind="item.tooltipProps">
<template #content>
<template v-if="item.tooltipProps.render">
<RenderProxy :render="item.tooltipProps.render"
:row="{ data, schemaItem: item, schema }" />
</template>
<template v-else>
{{ isZeroOrNumber(getValue(item.descKey || item.name, item)) }}
</template>
</template>
<div :class="item.parentProps.className" :style="{ width: item.valueWidth, ...item.parentProps.style }">
<template v-if="item.render">
<RenderProxy :render="item.render"
:row="{ data, schemaItem: item, schema }" />
</template>
<template v-else>
<slot :name="`${item.slot || item.name}-value`">
{{ isZeroOrNumber(getValue(item.descKey || item.name, item)) }}
</slot>
</template>
</div>
</el-tooltip>
</span>
</div>
</slot>
</template>
</el-col>
</template> </template>
<template v-else>
<slot :name="item.slot || item.name ">
<div class="form-item" :style="item.itemStyle || {}">
<div class="label text-hide"
:style="{ width: item.labelWidth || '150px' }"
:title="item.label">
<slot :name="`${item.slot || item.name}-label`">
{{ item.label }}{{ item.hideColon ? "" : ":" }}
</slot>
</div>
<div class="value">
<el-tooltip :disabled="!item.tooltip"
v-bind="item.tooltipProps">
<template #content>
<template v-if="item.tooltipProps.render">
<RenderProxy :render="item.tooltipProps.render"
:row="{ data, schemaItem: item, schema }" />
</template>
<template v-else>
{{ isZeroOrNumber(getValue(item.descKey || item.name, item)) }}
</template>
</template>
<div :class="item.parentProps.className" :style="{ width: item.valueWidth, ...item.parentProps.style }">
<template v-if="item.render">
<RenderProxy :render="item.render"
:row="{ data, schemaItem: item, schema }" />
</template>
<template v-else>
<slot :name="`${item.slot || item.name}-value`">
{{ isZeroOrNumber(getValue(item.descKey || item.name, item)) }}
</slot>
</template>
</div>
</el-tooltip>
</div>
</div>
</slot>
</template>
</el-col>
</template>
</el-row> </el-row>
</template> </template>
<script> <script>
...@@ -168,6 +168,7 @@ export default { ...@@ -168,6 +168,7 @@ export default {
> .value { > .value {
flex-shrink: 0; flex-shrink: 0;
flex: 1; flex: 1;
flex-basis: 0;
overflow: hidden; overflow: hidden;
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!