Here is a custom modal i made myself which is using slot to push content into it.
myModal.vue
<template>
<transition name="modal">
<div class="modal-mask">
<div class="modal-wrapper">
<header class="modal-header header-toolbar">
<h3>
<span>{{modalTitle}}</span>
</h3>
<span class="icon">
<i class="fa fa-times" aria-hidden="true" @click="hideModal"></i>
</span>
</header>
<section class="modal-body">
<slot></slot>
</section>
</div>
</div>
</transition>
</template>
<script>
export default {
name: 'my-modal',
props: {
modalTitle: {
type: String,
default: null,
},
},
methods: {
hideModal() {
this.$emit('hide');
},
},
};
</script>
How to use it:
<my-modal v-if="modalState" @hide="modalState = false">
...Content
</my-modal>
set modalState in data to false, or define it as prop or whatever.
when you want to show the modal just change it to true. If you want class definitions i can give you the scss also