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.

v-b-modal problem with v-if

See original GitHub issue

While I am not entirely sure if this is a Bootstrap Vue issue or a pure Vue issue please see the following:

Problem:

When a <b-btn> with a v-b-modal directive is replaced with another <b-btn> without that directive using v-if/v-else in VDOM the effects of the directive are bound also to the second component.

Template code:

<div id="app">
  <b-btn @click="doModal = !doModal">Toggle modal</b-btn>

  <b-btn v-b-modal.modal v-if="doModal">Modal</b-btn>

  <b-btn v-else>No modal</b-btn>
  
  <b-modal id="modal">Modal text</b-modal>

</div>

JS code:

new Vue({
	el: '#app',
  data: {
  	doModal: true,
  }
})

Working example: https://jsfiddle.net/fv1mjnfa/7/

Current result

Button named “Modal” triggers modal visibility. After clicking button named “Toggle modal” the above button is replaced by button named “No modal”. Clicking button “No modal” also triggers the modal.

Expected result

Button with “No modal” text should not trigger the modal.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mosinvecommented, Feb 14, 2018

I’ve slightly updated your examle to make it work https://jsfiddle.net/cihkem/5y2fs62q/ The catch is to add keys to elements, so Vue will treat them as different vnodes.

0reactions
mosinvecommented, Feb 15, 2018

Ok, I’ll review your proposals a bit later.

Read more comments on GitHub >

github_iconTop Results From Across the Web

12.4 - Detecting Multicollinearity Using Variance Inflation Factors
A VIF of 1 means that there is no correlation between the k t h predictor and the remaining predictor variables, and hence...
Read more >
How can I solve the issue that VIF doesn't work after added ...
I created ordered logit models using polr in RStudio and the using the vif. It worked fine and I got my results. But...
Read more >
Variance Inflation Factor (VIF) - Investopedia
Variance inflation factor (VIF) is a measure of the amount of multicollinearity in a set of multiple regression variables.
Read more >
Dealing with Multicollinearity Problem in Analysis of Side ...
If VIF is more than 5 for one or more of the independent variables, then steps must be taken to remove the multicollinearity...
Read more >
Frequency division denoising algorithm based on VIF ...
First, the ultrasound image was decomposed into a series of sub-modal images using 2D variational mode decomposition (2D-VMD), and adaptively ...
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