Radio

Customizable or editable radio buttons

Import

import { Radio } from  'mand-mobile-next'

Vue.createApp().component(Radio.name, Radio)

Code Examples

API

Radio Props

属性说明类型默认值备注
v-modelselected nameany-
nameunique nameany--
labeldescription textString--
disabledwhether disable optionBooleanfalse-
inlinewhether display as inline blockBooleanfalse-
iconselected icon nameStringchecked-
icon-inverseicon nameStringcheck-
icon-disabledicon of disabled optionsStringcheck-disabled-
icon-svguse svg iconBooleanfalse-
sizesize of iconStringmd-

RadioBox Props

Radio box

PropsDescriptionTypeDefaultNote
nameunique nameanytrue-
v-modelselected nameanyfalse-
disabledwhether disable selection or notBooleanfalse-

RadioGroup Props

Check multiple radios. Combine with Radio or RadioBox

PropsDescriptionTypeDefaultNote
v-modelselected namesArray--

RadioGroup Methods

check(name)
ArgDescriptionTypeDefault
namename will be selectedString-

Radio List Props

PropsDescriptionTypeDefaultNote
v-modelvalue of the selected itemany--
optionsoption data sourceArray<{text, value, disabled, ...}>[]disabled is to disable option or not
has-inputhas editable item or notBooleanfalse-
input-labelname of editable itemString-only when has-input is true
input-placeholderplaceholder of editable itemString-only when has-input is true
iconicon of selected optionStringchecked-
icon-inverseicon of unselected optionsStringcheck-
icon-disabledicon of disabled optionsStringcheck-disabled-
icon-sizethe size of iconStringlg-
icon-svguse svg iconBooleanfalse-
icon-positionthe position of iconStringleftleft, right
is-slot-scopeif it is mandatory to use slot-scopeBoolean-it depends on exact cases to determine whether to use it or not, and avoids adding if/else to component

Radio List Methods

select(value)

Set selected value

ParametersDescriptionType
valuevalue of optionString

Radio List Events

@change(option, index)

Selected option changed

PropsDescriptionType
optiondata of selected optionObject:{text, value, disabled, ...}
indexindex of selected optionNumber

Radio List Slots

<template>
  <md-radio-list :options="data">
    <template slot-scope="{ option, index, selected }">
      <div class="custom-title" v-text="option.text"></div>
      <div class="custom-brief">{{ option.text }}的自定义描述</div>
    </template>
  </md-radio-list>
</template>