ant-design-vue/components/switch/demo/disabled.md

515 B

#### 不可用 Switch 失效状态。 #### Disabled Disabled state of `Switch`.
<template>
  <div>
    <a-switch defaultChecked :disabled="disabled" style="margin-bottom:5px"/>
    <br/>
    <a-button type="primary" @click='onToggle'>Toggle disabled</a-button>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        disabled: true,
      }
    },
    methods: {
      onToggle(){
        this.disabled = !this.disabled
      }
    },
  }
</script>