- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
<template>
<transition name="fade" v-on:enter="enter">
<div
class="cart-panel-wrap"
v-if="$store.state.isCartVisible" >
<!-- :class="{'panel-visible': $store.state.isCartVisible,
'panel-invisible': !$store.state.isCartVisible}"> -->
<!-- Mobile's close button -->
<!-- <a href="#"
class="mobile-cartpanel-close"
@click.prevent='$store.commit("CART_TOGGLE", !$store.state.isCartVisible)'>
×
</a> -->
<a
href="#"
class="cartpanel-close"
@click.prevent='$store.commit("CART_TOGGLE", !$store.state.isCartVisible)'>
</a>
<!-- Toggler for Desktop -->
<!-- <div class="toggler-desktop"
@click='$store.commit("CART_TOGGLE", !$store.state.isCartVisible)'
v-if="$store.state.isCartVisible">
<div class="toggler-icon close"></div>
</div> -->
<iframe class='cart-iframe' src="" frameborder="0"></iframe>
</div>
</transition>
</template>
<script>
import { mapState } from 'vuex'
export default {
methods:{
enter () {
console.log('---0111')
}
},
data () {
return {
}
},
computed: mapState({
isCartVisible: state => state.isCartVisible
}),
watch: {
isCartVisible (old, newval) {
console.log(`old: ${old} new: ${newval}`)
}
}
}
</script>
<style lang="stylus" >
.fade-enter-active, .fade-leave-active
//animation slide-left 1s
transition opacity 1s
.fade-enter, .fade-leave-to
opacity 0
</style>
<style lang='stylus'>
.cart-panel-wrap
position fixed
top 0
bottom 0
right -580px
right 0
min-height 100%
background #fff
width 580px
z-index 10
//opacity 0
.cart-iframe
width 100%
height 100%
z-index 2
.panel-visible
right 0
animation slide-left 1s
.panel-invisible
right -560px
animation slide-right 1s
.cartpanel-close
background-size 50%
background-repeat no-repeat
background-color #ecc200
background-position center
background-image url(/nuxt-assets/img/icons/x-thick.svg)
width 40px
height 66px
display inline-block
// Anything smaller than 960px, show mobile iframe cart
@media (max-width: 960px)
.cart-panel-wrap
bottom 0
left 0
right 0
width 100%
min-height auto
height 0
top auto
background yellow
.toggler-desktop
background red
right 0
top 0
border 2px solid black
display none
.mobile-cartpanel-close
width 10px
height 10px
position absolute
right 0
display none
.panel-visible
height 100%
animation slide-up 1s
.panel-invisible
height 0
animation slide-down 1s
.cartpanel-close
background-color #262626
background-image none
width 25px
height 25px
border-radius 40px
display inline-block
right 3px
top 3px
position absolute
text-decoration none
text-align center
line-height 25px
color #fff
font-size 20px
&:after
content '×'
// Desktop uses theese
@keyframes slide-right
0%
right 0
100%
right -580px
border 2px solid red
visibility visible
@keyframes slide-left
0%
right -580px
100%
right 0
// And mobile uses these
@keyframes slide-up
0%
height 0
100%
height 100%
@keyframes slide-down
0%
height 100%
100%
height 0
</style>