D
D
dimonfreeman2021-06-14 23:00:41
Vue.js
dimonfreeman, 2021-06-14 23:00:41

Why does it swear at Unexpected 'v-bind' before ':'?

I tried instead of template and insert key and bind = everything is super.
But I don't need to wrap everything in a div...
and throws two errors
error Unexpected 'v-bind' before ':' vue/v-bind-style
error Elements in iteration expect to have 'v-bind:key' directives vue/ require-v-for-key

<template
        v-for="start in starts"
      >
        <input
          :id="input_q + '-star-' + start.id"
          :name="input_q"
          :value="start.id"
          v-bind:key="start.id"
          type="radio"
        >
        <label
          :for="input_q+'-star-'+start.id"
        >{{ start.id }}</label>
      </template>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Aetae, 2021-06-15
@dimonfreeman

v-bind:it's the same as :. And keyshould stand on each iterable element. Unique for each element. This is obvious, if you understand why the hell it is needed at all (to update only those pieces that have really been updated and save those that have not changed).
Those. keyyou need more and label.

R
Red_Devi1, 2021-06-14
@Red_Devi1

Just write :key="start.id", but in general, read the doc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question