Radio - 图1

Radio Vue Component

Radio Vue component represents Radio component.

Radio Components

There are following components included:

  • f7-radio

Radio Properties

PropTypeDefaultDescription
<f7-radio> properties
checkedbooleanDefines whether the radio input is checked or not
namestring
number
Radio input name
valuestring
number
boolean
Radio input value
disabledbooleanDefines whether the radio input is disabled
readonlybooleanDefines whether the radio input is readonly

Radio Events

EventDescription
<f7-radio> events
changeEvent will be triggered when radio input state changed

Radios List

Radios List is not a separate component, but just a particular case of using <f7-list>, <f7-list-item>.

  1. <f7-list>
  2. <!-- Additional "radio" prop to enable radio list item -->
  3. <f7-list-item radio value="check_1" name="demo-radio" checked title="Radio 1"></f7-list-item>
  4. <f7-list-item radio value="check_2" name="demo-radio" title="Radio 2"></f7-list-item>
  5. </f7-list>

Radio v-model

v-model is not supported on Radio vue component. Instead, just use the combination of checked property and @change event:

  1. <template>
  2. <f7-radio
  3. name="fruit"
  4. value="banana"
  5. :checked="fruit === 'banana'"
  6. @change="fruit = $event.target.value"
  7. ></f7-radio>
  8. <f7-radio
  9. name="fruit"
  10. value="orange"
  11. :checked="fruit === 'orange'"
  12. @change="fruit = $event.target.value"
  13. ></f7-radio>
  14. <f7-radio
  15. name="fruit"
  16. value="apple"
  17. :checked="fruit === 'apple'"
  18. @change="fruit = $event.target.value"
  19. ></f7-radio>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. fruit: 'apple'
  26. };
  27. },
  28. };
  29. </script>

Examples

  1. <f7-block-title>Inline</f7-block-title>
  2. <f7-block strong>
  3. <p>Lorem <f7-radio name="demo-radio-inline"></f7-radio> ipsum dolor sit amet, consectetur adipisicing elit. Alias beatae illo nihil aut eius commodi sint eveniet aliquid eligendi <f7-radio name="demo-radio-inline" checked></f7-radio> ad delectus impedit tempore nemo, enim vel praesentium consequatur nulla mollitia!</p>
  4. </f7-block>
  5. <f7-block-title>Radio Group</f7-block-title>
  6. <f7-block-header>Icon in the beginning of the list item</f7-block-header>
  7. <f7-list>
  8. <f7-list-item
  9. radio
  10. radio-icon="start"
  11. title="Books"
  12. name="demo-radio-start"
  13. checked
  14. ></f7-list-item>
  15. <f7-list-item
  16. radio
  17. radio-icon="start"
  18. title="Movies"
  19. name="demo-radio-start"
  20. ></f7-list-item>
  21. <f7-list-item
  22. radio
  23. radio-icon="start"
  24. title="Food"
  25. name="demo-radio-start"
  26. ></f7-list-item>
  27. <f7-list-item
  28. radio
  29. radio-icon="start"
  30. title="Drinks"
  31. name="demo-radio-start"
  32. ></f7-list-item>
  33. </f7-list>
  34. <f7-block-header>Icon in the end of the list item</f7-block-header>
  35. <f7-list>
  36. <f7-list-item
  37. radio
  38. radio-icon="end"
  39. title="Books"
  40. name="demo-radio-end"
  41. checked
  42. ></f7-list-item>
  43. <f7-list-item
  44. radio
  45. radio-icon="end"
  46. title="Movies"
  47. name="demo-radio-end"
  48. ></f7-list-item>
  49. <f7-list-item
  50. radio
  51. radio-icon="end"
  52. title="Food"
  53. name="demo-radio-end"
  54. ></f7-list-item>
  55. <f7-list-item
  56. radio
  57. radio-icon="end"
  58. title="Drinks"
  59. name="demo-radio-end"
  60. ></f7-list-item>
  61. </f7-list>
  62. <f7-block-title>With Media Lists</f7-block-title>
  63. <f7-list media-list>
  64. <f7-list-item
  65. radio
  66. checked
  67. name="demo-media-radio"
  68. value="1"
  69. title="Facebook"
  70. after="17:14"
  71. subtitle="New messages from John Doe"
  72. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  73. ></f7-list-item>
  74. <f7-list-item
  75. radio
  76. name="demo-media-radio"
  77. value="2"
  78. title="John Doe (via Twitter)"
  79. after="17:11"
  80. subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
  81. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  82. ></f7-list-item>
  83. <f7-list-item
  84. radio
  85. name="demo-media-radio"
  86. value="3"
  87. title="Facebook"
  88. after="16:48"
  89. subtitle="New messages from John Doe"
  90. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  91. ></f7-list-item>
  92. <f7-list-item
  93. radio
  94. name="demo-media-radio"
  95. value="4"
  96. title="John Doe (via Twitter)"
  97. after="15:32"
  98. subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
  99. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  100. ></f7-list-item>
  101. </f7-list>

← Progressbar

Range Slider →