提交 311dc826 编写于 作者: Shine-zwj's avatar Shine-zwj

面板属性组件

上级 7cefbed8
.app-panel-item { .app-panel-item {
height: 100%; height: 100%;
width: 100%;
display: flex;
padding: 0 6px; padding: 0 6px;
.editor { .editor{
height: 100%; flex-grow: 1;
.ivu-form-item-content { height: 34px !important;
height: 100%;
min-height: 36px;
}
} }
.app-panel-item-label { .app-panel-item-label {
height: 34px !important;
line-height: 25px;
flex-shrink: 0;
padding: 6px 10px 6px 0px; padding: 6px 10px 6px 0px;
} }
} }
.app-panel-item.label-top, .app-panel-item.label-bottom { .app-panel-item.label-top {
.app-panel-item-label { flex-flow: column;
display: block;
}
} }
.app-panel-item.label-left, .app-panel-item.label-right { .app-panel-item.label-bottom{
.app-panel-item-label, .editor { flex-flow: column-reverse;
height: 100%;
}
} }
.app-panel-item.label-left { .app-panel-item.label-left {
.app-panel-item-label { .app-panel-item-label {
float: left;
text-align: right; text-align: right;
position: absolute;
top: 2px;
} }
} }
.app-panel-item.label-right { .app-panel-item.label-right {
flex-flow: row-reverse;
.app-panel-item-label { .app-panel-item-label {
float: right;
padding: 6px 0px 6px 10px; padding: 6px 0px 6px 10px;
position: absolute;
top: 2px;
right: 16px;
} }
} }
......
<template> <template>
<div :class="classes"> <div :class="classes">
<div v-if="Object.is(this.labelPos,'BOTTOM') || Object.is(this.labelPos,'NONE') || !this.labelPos" class="editor" :style="slotstyle"> <div v-if="Object.is(this.labelPos,'NONE') || !this.labelPos" class="editor">
<div :class="valueCheck == true ?'':'editorStyle'"> <div :class="valueCheck == true ?'':'editorStyle'">
<slot ></slot> <slot ></slot>
</div> </div>
</div> </div>
<span v-if="!Object.is(this.labelPos,'NONE') && this.labelWidth > 0" :style="labelstyle" :class="labelclasses"> <div v-if="!Object.is(this.labelPos,'NONE')" class="app-panel-item-label">
<span v-if="required" style="color:red;">* </span> <span v-if="required" style="color:red;">* </span>
{{this.isEmptyCaption ? '' : this.caption}} {{this.isEmptyCaption ? '' : this.caption}}
</span> </div>
<div v-if="Object.is(this.labelPos,'TOP') || Object.is(this.labelPos,'LEFT') || Object.is(this.labelPos,'RIGHT')" class="editor" :style="slotstyle"> <div v-if="Object.is(this.labelPos,'BOTTOM') || Object.is(this.labelPos,'TOP') || Object.is(this.labelPos,'LEFT') || Object.is(this.labelPos,'RIGHT')" class="editor">
<div :class="valueCheck == true ?'':'editorStyle'"> <div :class="valueCheck == true ?'':'editorStyle'">
<slot ></slot> <slot ></slot>
</div> </div>
...@@ -59,14 +59,6 @@ export default class AppPanelItem extends Vue { ...@@ -59,14 +59,6 @@ export default class AppPanelItem extends Vue {
| "RIGHT" | "RIGHT"
| "TOP"; | "TOP";
/**
* 标签宽度
*
* @type {number}
* @memberof AppPanelItem
*/
@Prop({}) public labelWidth!: number;
/** /**
* 标签是否空白 * 标签是否空白
* *
...@@ -201,47 +193,6 @@ export default class AppPanelItem extends Vue { ...@@ -201,47 +193,6 @@ export default class AppPanelItem extends Vue {
return [ "app-panel-item", posClass ]; return [ "app-panel-item", posClass ];
} }
/**
* label样式
*
* @readonly
* @type {string}
* @memberof AppPanelItem
*/
get labelclasses(): string {
return this.labelStyle
? this.labelStyle + " app-panel-item-label"
: "app-panel-item-label";
}
/**
* label行内样式
*
* @readonly
* @type {string}
* @memberof AppPanelItem
*/
get labelstyle(): any {
if (Object.is(this.labelPos, 'LEFT') || Object.is(this.labelPos, 'RIGHT')) {
return { width: this.labelWidth + "px" };
}
}
/**
* slot行内样式
*
* @readonly
* @type {string}
* @memberof AppPanelItem
*/
get slotstyle(): any {
if (Object.is(this.labelPos, "LEFT")) {
return { marginLeft: this.labelWidth + "px" };
} else if (Object.is(this.labelPos, "RIGHT")) {
return { marginRight: this.labelWidth + "px" };
}
}
/** /**
* vue 生命周期 * vue 生命周期
* *
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册