Skip to content

Commit

Permalink
feat(banner): emit open and close events
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Jun 5, 2022
1 parent 154b56b commit 68cce15
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
</template>

<script setup>
import { computed, ref } from 'vue';
import { computed, ref, watchEffect } from 'vue';
const emit = defineEmits(['open', 'close'])
const props = defineProps({
show: {
type: Boolean,
Expand Down Expand Up @@ -49,4 +50,13 @@ const showBanner = computed(() => {
const closeBanner = () => {
forceCloseBanner.value = true
}
watchEffect(() => {
if (showBanner.value) {
emit('open')
} else {
emit('close')
}
})
</script>

0 comments on commit 68cce15

Please sign in to comment.