Reputation: 174
seemore.vue:
<template>
<div id="app">
<button type="button" class="btn btn-primary" v-on:click='ShowModal'>
Show
</button>
<div class="card" v-show="Modal">
<div class="card-header">
This is the header <button @click='$emit(close)' @close="Modal=false" class="float-right">×</button>
</div>
<div class="card-body">
This is the body
</div>
</div>
</div>
</template>
<script>
export default {
el: '#app',
data(){
return {
Modal:false,
}
},
methods: {
ShowModal(){
this.Modal=true;
}
},
};
index.blade.php:
<div id="app">
<seemore></seemore>
</div>
When i click the button the modal is showing, it is working but when i press the X button the modal is not hiding, i do not know what seems to be the problem.. but i am new to Vue Js so i may be doing something wrong
Upvotes: 0
Views: 346
Reputation: 692
How about this, set Modal to false when x button click
<template>
<div id="app">
<button type="button" class="btn btn-primary" v-on:click='ShowModal'>
Show
</button>
<div class="card" v-show="Modal">
<div class="card-header">
This is the header <button @click='Modal=false' class="float-right">×</button>
</div>
<div class="card-body">
This is the body
</div>
</div>
</div>
</template>
<script>
export default {
el: '#app',
data(){
return {
Modal:false,
}
},
methods: {
ShowModal(){
this.Modal=true;
}
},
};
Upvotes: 1