<form action="http://www.baidu.com" method="get">
            <label for="aa">
            <input type="checkbox" v-model="hobbies" value="study code" >study code</label>
            <!-- 1个for="aa"对应一个 -->
            <label for="bb">
            <input type="checkbox" v-model="hobbies" value="play game" >play game
            </label>
            <input type="checkbox" v-model="hobbies" value="play basketball">play basketball
            <input type="checkbox" v-model="hobbies" value="reading">reading
            <input type="checkbox" v-model="hobbies" value="tourist">tourist
            </label>
            <h2>你所选择的是:{{hobbies}}</h2>
        </form>
    </div>

</body>
<script>
    const app = new Vue({
        el: " #app ",
        data() {
            return {
                // isAgree: false,
                hobbies: [] //这里只能是数组
            }
        },
    })
</script>

vue中checkbox

相关文章:

  • 2021-12-09
  • 2021-08-26
  • 2022-12-23
  • 2022-01-10
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-24
  • 2021-05-09
  • 2021-07-31
  • 2021-12-23
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案