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>]($b7602c53a3a0cf4e.md), [<f7-list-item>]($02ada5844983cbd9.md).

  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-list>
  7. <f7-list-item radio title="Books" name="demo-radio" checked></f7-list-item>
  8. <f7-list-item radio title="Movies" name="demo-radio"></f7-list-item>
  9. <f7-list-item radio title="Food" name="demo-radio"></f7-list-item>
  10. <f7-list-item radio title="Drinks" name="demo-radio"></f7-list-item>
  11. </f7-list>
  12. <f7-block-title>With Media Lists</f7-block-title>
  13. <f7-list media-list>
  14. <f7-list-item
  15. radio
  16. checked
  17. name="demo-media-radio"
  18. value="1"
  19. title="Facebook"
  20. after="17:14"
  21. subtitle="New messages from John Doe"
  22. 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."
  23. ></f7-list-item>
  24. <f7-list-item
  25. radio
  26. name="demo-media-radio"
  27. value="2"
  28. title="John Doe (via Twitter)"
  29. after="17:11"
  30. subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
  31. 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."
  32. ></f7-list-item>
  33. <f7-list-item
  34. radio
  35. name="demo-media-radio"
  36. value="3"
  37. title="Facebook"
  38. after="16:48"
  39. subtitle="New messages from John Doe"
  40. 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."
  41. ></f7-list-item>
  42. <f7-list-item
  43. radio
  44. name="demo-media-radio"
  45. value="4"
  46. title="John Doe (via Twitter)"
  47. after="15:32"
  48. subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
  49. 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."
  50. ></f7-list-item>
  51. </f7-list>