Last active
November 17, 2022 08:10
-
-
Save JeffreyWay/2f610fdbae8681a0de92466c440885fd to your computer and use it in GitHub Desktop.
Learn Vue 3: Step By Step, Episode 30 - Teleporting - https://laracasts.com/series/learn-vue-3-step-by-step/episodes/30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup> | |
import Modal from "@/Components/Modal.vue"; | |
import {useTeamStore} from "@/stores/TeamStore"; | |
import { ref } from "vue"; | |
let showModal = ref(false); | |
let team = useTeamStore(); | |
</script> | |
<template> | |
<button | |
class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded disabled:bg-gray-400" | |
:disabled="! team.spotsRemaining" | |
@click="showModal = true" | |
>Add Member ({{ team.spotsRemaining }} Spots Left)</button> | |
<Teleport to="body"> | |
<Modal :show="showModal" @close="showModal = false"> | |
<template #default> | |
<p>Need to add a new member to your team?</p> | |
<form class="mt-6"> | |
<div class="flex gap-2"> | |
<input type="email" placeholder="Email Address..." class="flex-1"> | |
<button>Add</button> | |
</div> | |
</form> | |
</template> | |
</Modal> | |
</Teleport> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment