This repository has been archived on 2021-09-06. You can view files and clone it, but cannot push or open issues or pull requests.
vuejs_course/2021-09-06_reuse-04-composi.../src/hooks/alert.js

15 lines
280 B
JavaScript

import { ref } from 'vue';
export default function useAlert() {
const alertIsVisible = ref(false);
function showAlert() {
alertIsVisible.value = true;
}
function hideAlert() {
alertIsVisible.value = false;
}
return [alertIsVisible, showAlert, hideAlert];
}