|
@@ -4,7 +4,7 @@
|
|
|
:key="update"
|
|
|
:rules="rules"
|
|
|
class="flex-wrap f-form"
|
|
|
- :class="text ? 'text' : ''"
|
|
|
+ :class="{text:text,required:required}"
|
|
|
:model="form"
|
|
|
:label-position="labelPosition">
|
|
|
<el-form-item
|
|
@@ -97,6 +97,11 @@ export default {
|
|
|
online:{
|
|
|
type:Boolean,
|
|
|
default:false
|
|
|
+ },
|
|
|
+ // 是否有必填
|
|
|
+ required:{
|
|
|
+ type:Boolean,
|
|
|
+ default:false
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -213,7 +218,7 @@ export default {
|
|
|
// 增加rules为入参,判断当前项是否有必填校验,如果有那么width加上11px;
|
|
|
const val = this.labelWidth.find((e) => e.indexList.includes(index));
|
|
|
const rulesWidth = val.hasRules ? 11 : 0;
|
|
|
- return val.nameLength * 14 + rulesWidth + 16 + 'px';
|
|
|
+ return val.nameLength * 14 + rulesWidth + 16 + 10 + 'px';
|
|
|
},
|
|
|
// 将字符串转为16进制值,汉子转4位,英文字母和数组转2位
|
|
|
charCode: (str) =>
|
|
@@ -264,21 +269,24 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-.f-form .el-form-item {
|
|
|
- margin-bottom: 25px;
|
|
|
- display: inline-block;
|
|
|
+.f-form{
|
|
|
+ &.required .el-form-item:not(.is-required) ::v-deep.el-form-item__label{
|
|
|
+ padding-left: 9px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .el-form-item {
|
|
|
+ margin-bottom: 25px;
|
|
|
+ display: inline-block;
|
|
|
padding-right: 8px;
|
|
|
- // display: flex;
|
|
|
- // align-items: center;
|
|
|
- .el-change-icon {
|
|
|
- transform: rotate(90deg);
|
|
|
- }
|
|
|
- .el-form-item_custom {
|
|
|
- cursor: pointer;
|
|
|
- i {
|
|
|
- margin-left: 2px;
|
|
|
+ .el-change-icon {
|
|
|
+ transform: rotate(90deg);
|
|
|
+ }
|
|
|
+ .el-form-item_custom {
|
|
|
+ cursor: pointer;
|
|
|
+ i {
|
|
|
+ margin-left: 2px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
</style>
|