本文介绍了Vuetify 如何根据需要标记字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我们尝试在互联网上填写表格时,必填字段使用红色*"标记来表示该字段是必须的.
When we try to fill forms in the internet, required fields are marked using a red color ' * ' mark to indicate that the field is a must.
像这样,有没有办法在 vuetify.js 中向用户指示必填字段?
Like that is there a way to indicate users to required fields in vuetify.js?
推荐答案
来自 v1.1.0 文档:
所需的道具不再明确地向标签添加星号.v1.0 中删除了其所有验证功能.
所以显然没有什么可以将其设置为所需的了,我们必须在标签中手动添加它:
So apparently nothing will set it as required anymore, we have to add it manually in the label:
label="Name*"
或者你可以使用 CSS:
Or you could use CSS:
.required label::after {
content: "*";
}
您必须手动添加required
类(当然类的名称是任意的).
Tho you must add required
class manually (name of the class is arbitrary of course).
这篇关于Vuetify 如何根据需要标记字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!