-
Copy paste the
UserItem.vue
&UserList.vue
from the previous exercise intosrc/components/user
. -
Create a component
BaseDialog.vue
into thesrc/components/UI
folder. This component will use anamed slot
for header and adefault slot
for content, and anothernamed slot
for footer (button). Use theteleport
component to attach the dialog to the body. Hint: You can use the htmldialog
tag Documentation Emit aclose
event, when user clicks outside the dialog. -
Move the
users
array fromUserList.vue
toApp.vue
. -
Provide
users
array into the dependency injection fromApp.vue
. Retrieve theusers
from the dependency injection intoUserList.vue
. -
Use
BaseDialog
component intoUserList.vue
. Put a title in the header slot. Put a message in the default contentslot
. Put aconfirm button
on footer slot. On the confirm button, call a method to remove the user form the injectedusers
array (Hint : usearray.splice
instead ofarray.filter
) Usev-if
to check if the dialog should be shown, when eventdelete-user
is emitted. Listenclose
event to hide dialog.
npm install
npm run serve
npm run build
npm run lint