如何使用Vue在重复的输入元素上设置input id
和label for
,使其唯一.JSV2.
<section class="section" v-for="(section, i) in sections">
<div class="fields">
<fieldset>
<input type="checkbox" id="" name="example-a" v-model="section.ex-a">
<label for="">Example A</label>
</fieldset>
<fieldset>
<label for="">Example B</label>
<input type="text" id="" name="example-b" v-model="section.ex-b">
</fieldset>
<fieldset>
<label for="">Example C</label>
<input type="text" id="" name="example-c" v-model="section.ex-c">
</fieldset>
</div>
</section>
我希望能够点击标签元素,让它 Select 输入字段.