element/examples/docs/radio.md
2016-07-27 14:15:02 +08:00

4.4 KiB

基本用法

<template>
  <el-radio class="radio" :value.sync="radio" label="单选框 A"></el-radio>
  <el-radio class="radio" :value.sync="radio" label="单选框 B"></el-radio>
  <el-radio class="radio" :value.sync="radio" label="单选框 C"></el-radio>
</template>

<script>
  export default {
    data () {
      return {
        radio: '选中且禁用'
      }
    }
  }
</script>

Radio Group

<el-radio-group :value.sync="radio2">
  <el-radio :label="9"></el-radio>
  <el-radio :label="6"></el-radio>
  <el-radio :label="3"></el-radio>
</el-radio-group>

Radio Group Button

<el-radio-group :value.sync="radio31" size="large">
  <el-radio-button label="上海"></el-radio-button>
  <el-radio-button label="北京"></el-radio-button>
  <el-radio-button label="广州" :disabled="true"></el-radio-button>
  <el-radio-button label="深圳"></el-radio-button>
</el-radio-group>
<el-radio-group :value.sync="radio32">
  <el-radio-button label="上海"></el-radio-button>
  <el-radio-button label="北京"></el-radio-button>
  <el-radio-button label="广州" :disabled="true"></el-radio-button>
  <el-radio-button label="深圳"></el-radio-button>
</el-radio-group>
<el-radio-group :value.sync="radio33" size="small">
  <el-radio-button label="上海"></el-radio-button>
  <el-radio-button label="北京"></el-radio-button>
  <el-radio-button label="广州" :disabled="true"></el-radio-button>
  <el-radio-button label="深圳"></el-radio-button>
</el-radio-group>

禁用

<el-radio disabled :value.sync="radio" label="禁用"></el-radio>
<el-radio disabled :value.sync="radio1" label="选中且禁用"></el-radio>

Radio API

参数 说明 类型 可选值 默认值
value 绑定值 string
label 真实值 string
disabled 禁用 boolean true, false false

Radio Group API

参数 说明 类型 可选值 默认值
value 绑定值 string
size 尺寸 string large, small

Radio Button API

参数 说明 类型 可选值 默认值
label 真实值 string
disabled 禁用 boolean true, false false