A
A
Alexander Ivanov2018-07-13 10:56:35
Vue.js
Alexander Ivanov, 2018-07-13 10:56:35

Why might vue complain in this example([Vue warn]: ... value as key)?

[Vue warn]: Avoid using non-primitive value as key, use string/number value instead.

template
<v-text-field
                    v-model="editedItem.url"
                    label="Домен"
                    :rules="urlRules"
                     :error-messages="nameErrors"
                    placeholder="Пример https://test.com" />

js
mixins: [validationMixin],
        validations: {
            url: { required },
        },
...
  computed: {
            nameErrors () {
                const errors = [];
                let errorMsg = '';
                if (!this.$v.url.$dirty) return errors;
                if(!!this.errorsUrlTxt){
                    errorMsg = this.errorsUrlTxt;
                    !this.$v.url.required && errors.push(errorMsg);
                }
                return errors
            },
        },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2018-07-13
@cimonlebedev

So he stopped swearing, apparently he didn’t like that I was conveying the type of which he could not determine

!this.$v.url.required && errors.push(`${errorMsg}`);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question