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/components/DeleteUser.vue

29 lines
591 B
Vue

<template>
<user-alert v-if="alertIsVisible" title="Delete the User?" @close="hideAlert">
<p>Do you want to continue with deleting a user?</p>
</user-alert>
<section>
<h2>Delete a User</h2>
<button @click="showAlert">Delete User</button>
</section>
</template>
<script>
import UserAlert from './UserAlert.vue';
import useAlert from '../hooks/alert';
export default {
components: {
UserAlert
},
setup() {
const [alertIsVisible, showAlert, hideAlert] = useAlert();
return {
alertIsVisible,
showAlert,
hideAlert
};
}
};
</script>