Vue:state,这是什么?

问题描述 投票:1回答:2

我正在使用https://bootstrap-vue.org/docs/reference/validation#vuelidate,并且遇到了

:state作为vue属性。

我没有在文档中找到任何东西,我很困惑。它来自哪里,它是做什么的?实际上似乎我需要使用它来验证输入字段。但我宁愿使用@blur代替state,但无法正常工作。

vue.js bootstrap-vue vuelidate
2个回答
2
投票

docs中所述:

状态-布尔值-空

控制组件的验证状态外观。 “ true”表示有效,“ false”表示无效”,“ null”表示无验证状态

并动态绑定此属性,我们可以使用v-bind指令,如:

<b-form-select
   id="example-input-2"
   v-bind:state="validateState('food')"
></b-form-select>

或者我们可以使用v-bind:state的简写,就像:state一样:

<b-form-select
   id="example-input-2"
   :state="validateState('food')"
></b-form-select>

0
投票

“状态”是子组件中的属性之一,它期望从主vue文件传递或被称为“父组件”的布尔值。

© www.soinside.com 2019 - 2024. All rights reserved.