<basket v-show="showModalBasket" @close="showModalBasket = false"></basket>
<basketend v-if="showModalBasketEnd"></basketend>
data() {
return {
showModalBasket: false
showModalBasketEnd: false
}
}
corzina(v-if="uslovie")
modal(v-else)
в дате uslovie: true/falsemodal(:modalChecker="modalState")
props: { modalChecker }
{{modalChecker}}
import Vue from 'vue'
import VueScrollactive from 'vue-scrollactive'
import store from './store.js'
Vue.use(VueScrollactive);
require('./bootstrap');
import App from './App.vue'
const app = new Vue({
el: '#app',
components: {App},
store: new Vuex.Store(store)
});
<basket v-show="showModalBasket" @close="showModalBasket = false"></basket>
<backtotop></backtotop>
<basketend v-on:remove="removeFromList"></basketend>
</div>
</template>
<script>
import hotitems from './components/HotItems.vue'
import diarieshead from './components/DiariesHead.vue'
import giftpenshead from './components/GiftPensHead.vue'
import penshead from './components/PensHead.vue'
import basket from './components/Basket.vue'
import backtotop from './components/BackToTop.vue'
import basketend from './components/BasketEnd.vue'
export default {
props: ['data'],
data() {
return {
items: [
'Горячие новинки',
'Ежедневники',
'Подарочные ручки',
'Ручки'
],
showModalBasket: false,
active: false
}
},
methods: {
removeFromList() {
console.log(1)
},
showBasket: function () {
event.preventDefault()
this.showModalBasket = true
},
clickMenu: function() {
this.active = !this.active
},
openBasketEnd: function () {
console.log(1)
this.showModalBasketEnd = true
}
},
components: {hotitems, diarieshead, giftpenshead, penshead, basket, backtotop, basketend}
}
</script>
<basketend v-bind:bask="baskState"></basketend> //состояние чекера передаем (true/false).
в basketend пишешьprops: {
bask: {
type: boolean
}
}
<template>
<div class="basket-end_wrapp">
<div class="basket-end">
<span>Спасибо за заказ!</span>
</div>
</div>
</template>
<script>
export default {
props: {
bask: {
type: boolean
}
}
}
</script>
<basketend v-on:bask="baskState"></basketend>
@click="showElement",
showElement() { this.baskState = !this.baskState }
v-if(bask) // bask потому что в компоненте мы его записали по-другому
showElement() { bask = !bask }
значит просто this.bask = !this.bask
<template>
<div class="basket-end_wrapp" v-if="bask">
<div class="basket-end">
<span>Спасибо за заказ!</span>
</div>
</div>
</template>
<script>
export default {
props: {
bask: {
type: Boolean
}
}
}
</script>
<basketend :bask="baskState" v-if="baskState"></basketend>
removeItem: function() {
this.baskState = !this.baskState
console.log(this.baskState)
},
@click="removeItem"
где?