tiny-vue/examples/sites/demos/pc/app/switch/before-change-composition-a...

19 lines
497 B
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<tiny-switch v-model="value" :before-change="beforeChange"></tiny-switch>
</template>
<script setup>
import { ref } from 'vue'
import { Switch as TinySwitch, Modal } from '@opentiny/vue'
const value = ref(false)
function beforeChange(done) {
Modal.message({
message: '开关切换功能已被拦截,必须调用 done 方法才能执行开关状态的切换2s后将自动调用 done 方法切换开关状态',
status: 'info'
})
setTimeout(done, 2000)
}
</script>