twitter bootstrap - custom modals with vue js scrolling issue -
i'm creating bootstrap modals vue js , following tutorial few tweaks, , works fine when have long modals got issue scrolling page, since scrolling page behind modals not modals
here modal.vue component
<template> <div class="modal-mask" @click="close" v-show="created"> <transition name="modal" enter-active-class="animated bounceinup" leave-active-class="animated bounceoutdown" mode="out-in" v-on:enter="beforeenter" v-on:after-leave="afterleave" > <div class="modal-dialog" :class="size" v-if="show" @click.stop> <div class="modal-content"> <div class="modal-header" :class="color"> <button type="button" class="close" @click="close">×</button> <h6 class="modal-title"> <slot name="title"></slot> </h6> </div> <div class="modal-body"> <slot></slot> </div> <div class="modal-footer"> <slot name="button"></slot> </div> </div> </div> </transition> </div> </template> <script> export default{ props: ['show','color','size'], data(){ return{ created: false, } }, mounted(){ document.addeventlistener("keydown", (e) => { if (this.show && e.keycode == 27) { this.close(); } }); }, methods: { close(){ this.$emit('close'); }, beforeenter(){ this.created = true }, afterleave(){ this.created = false } } } </script> <style> .modal-mask { position: fixed; z-index: 9998; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, .5); transition: opacity .3s ease; } </style> and need import modal.vue component page needed.
so how fix scrolling issue?
well set css prop overflow-y: auto modal-body class
.modal-body { overflow-y: auto; }
Comments
Post a Comment