跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • v-model 在 input type=”radio”中是如何进行分组的?
未分類
8 4 月 2021

v-model 在 input type=”radio”中是如何进行分组的?

v-model 在 input type=”radio”中是如何进行分组的?

資深大佬 : hm20062006ok 7

原始的 HTML 中定义两个 radio 的单选项,是根据 name 来分组:
<input type=”radio” name=”gender” value=”male”/>
<input type=”radio” name=”gender” value=”female”/>

Vue 中是这样写:
<input type=”radio” v-model=”gender” value=”male” >
<input type=”radio” v-model=”gender” value=”female”>
F12 发现 Vue 并没有去改变 name 的值,还是可以正确的分组。

是怎么做到的呢?

大佬有話說 (1)

  • 資深大佬 : MiracleKagari

    这里的 v-model bind 了 checked

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具