feat: added toggler component

This commit is contained in:
Shariq Ansari 2023-07-31 12:16:07 +05:30
parent c2542efa93
commit 1b54e9c721

View File

@ -0,0 +1,24 @@
<template>
<slot v-bind="{ opened, open, close, toggle }"></slot>
</template>
<script setup>
import { ref } from 'vue'
const props = defineProps({
isOpened: {
type: Boolean,
default: true,
},
})
function toggle() {
opened.value = !opened.value
}
function open() {
opened.value = true
}
function close() {
opened.value = false
}
let opened = ref(props.isOpened)
</script>