How to implement the code that displays an asterisk in front of the el-form form item but does not verify this item

Renderings:

1. Set the prop attribute to an empty string;

2. Also set the required attribute to true.

This allows the asterisks to be displayed without validation.

Sample code:

<el-form>
<el-form-item label="姓名" prop="name" required> <el-input v-model="form.name"></el-input> </el-form-item> 
<el-form-item label="年龄" prop="" required> <el-input v-model="form.age"></el-input> </el-form-item> 
</el-form>

In the above code, the first form item sets the prop attribute to "name", indicating that validation is required; while the second form item sets the prop attribute to an empty string, indicating that no validation is required, but sets the required attribute to true to display an asterisk.

 

Guess you like

Origin blog.csdn.net/killerdoubie/article/details/131291393