feat: added toggler component
This commit is contained in:
parent
c2542efa93
commit
1b54e9c721
24
frontend/src/components/Toggler.vue
Normal file
24
frontend/src/components/Toggler.vue
Normal 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>
|
||||||
Loading…
x
Reference in New Issue
Block a user