-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db53bad
commit 7e2759b
Showing
8 changed files
with
353 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.cartControl | ||
font-size 0 | ||
.cart-decrease, .cart-add | ||
display inline-block | ||
padding 6px | ||
line-height 24px | ||
font-size 24px | ||
vertical-align top | ||
color rgb(0, 160, 220, 0.2) | ||
.cart-count | ||
display inline-block | ||
font-size 10px | ||
line-height 24px | ||
width 12px | ||
vertical-align top | ||
padding-top 6px | ||
text-align center | ||
color rgb(147, 153, 159) | ||
.cart-decrease | ||
padding 4px 6px 6px 6px | ||
&.fade-enter-active | ||
animation: bounce-in .5s; | ||
&.fade-leave-active | ||
animation: bounce-out .5s; | ||
@keyframes bounce-in { | ||
0% { | ||
transform: scale(0); | ||
} | ||
50% { | ||
transform: scale(1.5); | ||
} | ||
100% { | ||
transform: scale(1); | ||
} | ||
transform transition3D(0,0,0) | ||
} | ||
@keyframes bounce-out { | ||
0% { | ||
transform: scale(1); | ||
} | ||
50% { | ||
transform: scale(1.5); | ||
} | ||
100% { | ||
transform: scale(0); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<div class="cartControl"> | ||
<transition name="fade"> | ||
<span class="iconfont icon-jian cart-decrease" v-show="food.count>0" @click="decreaseCart($event)"></span> | ||
</transition> | ||
<span class="cart-count" v-show="food.count > 0 "> | ||
{{food.count}} | ||
</span> | ||
<span class="iconfont icon-jia cart-add" @click="addCart($event)"></span> | ||
</div> | ||
</template> | ||
|
||
<script type="text/ecmascript-6"> | ||
import Vue from 'vue'; | ||
export default { | ||
props: { | ||
food: { | ||
type: Object | ||
} | ||
}, | ||
methods: { | ||
addCart(event) { | ||
if (!event._constructed) { | ||
// 去掉自带click事件的点击 | ||
return; | ||
} | ||
if (!this.food.count) { | ||
Vue.set(this.food, 'count', 1); | ||
} else { | ||
this.food.count++; | ||
} | ||
}, | ||
decreaseCart(event) { | ||
if (!event._constructed) { | ||
// 去掉自带click事件的点击 | ||
return; | ||
} | ||
this.food.count--; | ||
} | ||
} | ||
}; | ||
</script> | ||
<style lang="stylus" rel="stylesheet/stylus"> | ||
@import "cartControl.styl"; | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
.shopCart | ||
position fixed | ||
left 0px | ||
bottom 0px | ||
z-index 50 | ||
width 100% | ||
height 48px | ||
.content | ||
display flex | ||
background #141d27 | ||
.content-left | ||
flex 1 | ||
.logo-wrapper | ||
display inline-block | ||
position relative | ||
top -10px | ||
margin 0 12px | ||
padding 6px | ||
width 56px | ||
height 56px | ||
box-sizing border-box | ||
vertical-align top | ||
border-radius 50% | ||
background #141d27 | ||
.num | ||
position absolute | ||
top 0 | ||
right 0 | ||
width 24px | ||
height 24px | ||
line-height 24px | ||
text-align center | ||
border-radius 16px | ||
font-size 9px | ||
font-weight 700 | ||
color #ffffff | ||
background rgb(240, 20, 20) | ||
box-shadow 0 4px 8px 0 rgba(0, 0, 0, 0.4) | ||
.logo | ||
width 100% | ||
height 100% | ||
text-align center | ||
border-radius 50% | ||
background #2b343c | ||
&.highlight | ||
background rgb(0, 160, 220) | ||
.icon-gouwuche | ||
line-height 44px | ||
font-size 24px | ||
color #80858a | ||
&.highlight | ||
color #fff | ||
.price | ||
display inline-block | ||
vertical-align top | ||
margin-top 12px | ||
line-height 24px | ||
padding-right 12px | ||
box-sizing border-box | ||
border-right 1px solid rgba(255, 255, 255, 0.1); | ||
font-size 16px | ||
font-weight 700 | ||
color rgba(255, 255, 255, 0.4); | ||
&.highlight | ||
color #ffffff | ||
.desc | ||
display inline-block | ||
vertical-align top | ||
line-height 24px | ||
margin-left 12px | ||
margin-top 12px | ||
color rgba(255, 255, 255, 0.4) | ||
font-size 10px | ||
.content-right | ||
flex 0 0 105px | ||
width 105px | ||
.pay | ||
height 48px | ||
line-height 48px | ||
text-align center | ||
font-size 12px | ||
color rgba(255, 255, 255, 0.4); | ||
font-weight 700 | ||
background #2b333b | ||
&.not-enough | ||
background #2b333b | ||
&.enough | ||
background #00b43c | ||
color #ffffff |
Oops, something went wrong.