Radio 单选框

说明

基本组件-单选框。主要用于一组可选项单项选择,或者单独用于切换到选中状态。

代码示例

  • 单独使用
>{}
<template>
  <div>
    <Radio v-model="the.data" :value="1" @onEvent="onBtnRadio"></Radio>

    <Radio v-model="the.data" :value="0" @onEvent="onBtnRadio" />
    否0
  </div>
</template>

<script>
export default {
  setup(props, context) {
    // 使用外挂方式引入,具体查看demo
    const $plus = window.$plus;
    const reactive = $plus.vue.reactive;

    const the = reactive({
      data: {
        bool: false,
      },
    });

    const onBtnRadio = (res) => {
      console.log(res);
    };
    return { the, onBtnRadio };
  },
};
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  • 使用 RadioGroup 进行多个分组使用
>{}
<template>
  <div>
    <RadioGroup v-model="the.data" :list="the.radioGroupList" />
  </div>
</template>

<script>
export default {
  setup(props, context) {
    // 使用外挂方式引入,具体查看demo
    const $plus = window.$plus;
    const reactive = $plus.vue.reactive;

    const the = reactive({
      data: 2,
      radioGroupList: {
        0: '初始',
        1: '正常',
        2: '已审',
        3: '撤审',
        4: '删除',
      },
    });

    return { the };
  },
};
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

API

Radio Props

属性说明类型默认值
named 0.4.8组件命名Stringradio
v-model双向绑定数据String-
value参数值Boolean-

Radio events

事件名说明返回值
onEvent点击触发回调事件json

Events cmd change

  • 选中触发
参数名说明类型
valueprops 的 value 参数值String
checked是否选中Boolean

RadioGroup props

属性说明类型默认值
named 0.4.8组件命名StringradioGroup
list单选框的内容和状态Object-
v-model双向绑定数据String-
onEvent点击触发回调事件json-

Last Updated: