简体   繁体   English

是否可以在Vee Validate中更改aria属性的位置?

[英]Is it possible to change position of aria attributes in Vee Validate?

As far as I know, aria-required and aria-invalid attributes are positioned on the input tag where you embed the v-validate attribute. 据我所知,必须使用aria和aria无效的属性位于嵌入v-validate属性的输入标签上。 Eg. 例如。

<input class="a" type="text" v-validate="'required'">

will manifest itself as: 将表现为:

<input class="a" type="text" aria-required="true" aria-invalid>

in the DOM. 在DOM中。

If I had a div around my input, is it possible for the aria attributes to manifest in the div? 如果我在输入周围有一个div,那么aria属性是否有可能在div中体现? So that it will look like: 这样它将看起来像:

<div class="b" aria-required="'true'" aria-invalid>
  <input class="a" type="text">
</div>

Refer to: developer.mozilla.org 请参阅: developer.mozilla.org

The aria-required attribute is used to indicate that user input is required on an element before a form can be submitted. aria-required属性用于指示在提交表单之前,需要在元素上输入用户信息。 This attribute can be used with any typical HTML form element. 此属性可以与任何典型的HTML表单元素一起使用。 And <div> tag is not a form element so it can not be used with aria attribute. 并且<div>标记不是表单元素,因此不能与aria属性一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM