mirror of https://github.com/nocodb/nocodb
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.
32 lines
733 B
32 lines
733 B
<script lang="ts" setup> |
|
const props = withDefaults( |
|
defineProps<{ checked: boolean; disabled?: boolean; size?: 'default' | 'small'; loading?: boolean }>(), |
|
{ |
|
size: 'small', |
|
}, |
|
) |
|
const emit = defineEmits(['change', 'update:checked']) |
|
const checked = useVModel(props, 'checked', emit) |
|
|
|
const loading = computed(() => props.loading) |
|
|
|
const onChange = (e: boolean) => { |
|
emit('change', e) |
|
} |
|
</script> |
|
|
|
<template> |
|
<a-switch |
|
v-model:checked="checked" |
|
:disabled="disabled" |
|
:loading="loading" |
|
:size="size" |
|
class="nc-switch" |
|
v-bind="$attrs" |
|
@change="onChange" |
|
> |
|
</a-switch> |
|
<span v-if="$slots.default" class="cursor-pointer pl-2" @click="checked = !checked"> |
|
<slot /> |
|
</span> |
|
</template>
|
|
|