You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/switch/demo/disabled.vue

46 lines
721 B

<docs>
---
order: 1
title:
zh-CN: 不可用
en-US: Disabled
---
## zh-CN
Switch 失效状态
## en-US
Disabled state of `Switch`.
</docs>
<template>
<div>
<a-switch v-model:checked="checked" :disabled="disabled" style="margin-bottom: 5px" />
<br />
<a-button type="primary" @click="onToggle">Toggle disabled</a-button>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
export default defineComponent({
setup() {
const checked = ref<boolean>(true);
const disabled = ref<boolean>(true);
const onToggle = () => {
disabled.value = !disabled.value;
};
return {
checked,
disabled,
onToggle,
};
},
});
</script>