Switch 开关

Switch 开关

在两种状态间切换时用到的开关选择器。

Switch 代码示例

>{}
<template>
  <Switch v-model="the.value" @onEvent="onSwitch" />
</template>

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

    const the = reactive({
      value: true,
    });

    const onSwitch = (resp) => {
      console.log('onSwitch', resp);
      // $plus.message.info('收到事件', {
      //   text: JSON.stringify(resp),
      //   // pars: '点击传递的参数',
      //   // 不自动关闭
      //   timeout: 0,
      // });
    };

    return { the, onSwitch };
  },
};
</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

Switch props

属性说明类型默认值
named 0.4.3组件命名Stringswitch
v-model双向绑定数据String, Number, Boolean-
disabled 0.4.8设置为禁用,会变成灰色stringdisabled

Switch events

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

Events cmd switch

参数名说明类型
named组件命名String
checked是否开启Boolean
event触发对象Object

Last Updated: