Ways to resolve Quasar vuelidate error message type error
P粉046387133
P粉046387133 2024-01-08 11:59:36
0
1
570

I am using "vuelidate" to validate the Quasar framework.

When I wrote the code below, a type error occurred.

(property) error message: string |reference number Input 'string|' Ref' is not assignable to type 'string|' undefined'.

I think the "error-message" attribute is undefined before the error occurs.

But the Quasar team only defines the error message type as String type.

How can I solve this problem? please help me.

Sorry, my English is no good

<q-input
            label="Name"
            v-model="company.name"
            @blur="v$.name.$touch()"
            no-error-icon
            :error="v$.name.$error"
            :error-message="
              v$.name.$errors.length ? v$.name.$errors[0].$message : ''
            "
          ></q-input>
P粉046387133
P粉046387133

reply all(1)
P粉635509719

It seems to be both

unref(v$.name.$errors[0].$message)

and

v$.name.$errors[0].$message.toString()

Eliminate this error. I'm not sure which is the better solution.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template