F
F
fisherspoons2021-06-03 22:19:37
Vue.js
fisherspoons, 2021-06-03 22:19:37

How to display input opposite the desired checkbox?

Hello everyone, there is a need to show inputs opposite the desired checkbox, I can’t figure out how to fix them opposite the desired one.

code pen

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2021-06-03
@fisherspoons

data: () => ({
  items: Array.from({ length: 4 }, () => ({
    checked: false,
    value: '',
  })),
}),

<div v-for="(n, i) in items">
  <label>
    <input type="checkbox" v-model="n.checked">
    {{ i }}
  </label>
  <input v-if="n.checked" v-model="n.value">
</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question