question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modal not displaying when using router

See original GitHub issue

I’m having an issue with my modal not displaying. I’ve attached a zip file with my code, but here’s the process I went through:

  1. I created a baseline project with vue-cli using the following command:

vue init webpack bootstraptest

Through the prompts, I answered Yes for using router, and no for everything else.

  1. Then I installed bootstrap and bootstrap-vue with

npm install --save bootstrap bootstrap-vue

  1. I added the following to the main.js file:
import BootstrapVue from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

Vue.use(BootstrapVue)`

  1. I modified the Hello.vue file to look like such:
<template>
  <div class="hello">
    <h1>Modal Test</h1>
    <b-btn @click="$root.$emit('show::modal', 'modal1')">Show Modal</b-btn>

    <b-modal id="modal1" title="Submit your name">
      <h3>Hello Modal</h3>
    </b-modal>
  </div>
</template>

<script>
export default {
  
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>

Running this (while using the Chrome Vue dev tools) I can click the button and see the event being fired for the modal to display, but it’s not displaying. I tried the same process without using router and it seems to work fine.

bootstraptest.zip

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mosinvecommented, Apr 7, 2017

I downloaded your code. Seems that you use Bootstrap 3 instead of supported 4 please install bootstrap as follows npm install bootstrap@4.0.0-alpha.6

0reactions
rwb7041commented, Apr 7, 2017

That’s bizzare because it worked with bootstrap 3 without using router i thought… oh well. Guess I can’t use this as my project breaks with bootstrap 4 in its current state

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - React modal not displaying
Hi, In your file ModalItem.js you use different components in your render function that don't exist (Modal.Dialog, Modal.Header,...), change ...
Read more >
Create contextual modal navigation with React Router V6.
When we click on the open-modal to open the modal, we do not want to show only the modal with a blank page...
Read more >
ion-modal
ion-modal is a dialog that appears on top of mobile app content, and must be dismissed before interaction resumes. Learn more about custom...
Read more >
Building a modal module for React with React-Router
Modals are very useful for displaying one view on top of another. ... Since this is not a react-router tutorial, I won't be...
Read more >
MDB Angular Frame Modal not showing when using ...
You need to remove 2 outer divs from cookie-modal html (the first one should be the one with class 'modal-content, the rest will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found