tiny-vue/examples/sites/demos/mobile/app/switch/switch-event-change.vue

33 lines
494 B
Vue

<template>
<div class="switch-wrap">
<tiny-switch :value="value" @change="handleChange"></tiny-switch>
</div>
</template>
<script lang="jsx">
import { Switch } from '@opentiny/vue'
export default {
components: {
TinySwitch: Switch
},
data() {
return {
value: true
}
},
methods: {
handleChange(val) {
let msg = val ? '已开启' : '已关闭'
console.log(msg)
}
}
}
</script>
<style scoped>
.switch-wrap {
padding: 20px;
}
</style>