search

Home  >  Q&A  >  body text

Ways to resolve Quasar vuelidate error message type error

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粉046387133P粉046387133339 days ago551

reply all(1)I'll reply

  • P粉635509719

    P粉6355097192024-01-09 10:26:01

    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.

    reply
    0
  • Cancelreply