<template>
<el-form-item prop="name" label="名称" class="form-item-require-lable"/>
</template>
<style lang="scss">
.form-item-require-lable {
.el-form-item__label:before {
content: "*";
color: #f56c6c;
margin-right: 5px;
font-weight: bold;
}
}
.form-item-normal-lable {
.el-form-item__label:before {
content: "";
margin-right: 12px;
font-weight: bold;
}
}
</style>
<template>
<el-form-item prop="name">
<div slot="label" style="margin-left:10px;">名称</div>
<el-input v-model="form.name" placeholder="请输入名称"></el-input>
</el-form-item>
</template>
Vue Elementui 表单必填项和非必填项label文字对齐的简单方式
原文:https://www.cnblogs.com/leslie1943/p/13359605.html