Level 50
<script setup>
import { usePage } from '@inertiajs/inertia-vue3';
import { computed, ref, watch } from 'vue';
const page = usePage();
const showFlash = ref(false);
const flash = computed(function () {
return page.props.value.flash;
});
watch(page.props, function (val) {
if (val?.flash) {
showFlash.value = true;
}
}, {
immediate: true,
deep: true,
});
</script>
<template>
<div v-if="showFlash && flash.message" @click="showFlash = false">
{{ flash.message }} - {{ flash.type }}
</div>
</template>
9 likes