|
|
@@ -1,13 +1,28 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <button style="z-index: 1000;" class="btn btn-primary btn-buy-now" :class="{'disabled': disabledFlag}" @click="buyNow(true, $event)"><span class="watch">立即购买</span></button>
|
|
|
- <button style="z-index: 1000;" class="btn btn-add-cart" :class="{'disabled': disabledFlag}" @click="buyNow(false, $event)"><span class="watch">加入购物车</span></button>
|
|
|
+ <button style="z-index: 1000;"
|
|
|
+ class="btn btn-primary btn-buy-now"
|
|
|
+ :style="btnColor ? `background:${btnColor};border-color:${btnColor};` : ''"
|
|
|
+ :class="{'disabled': disabledFlag}"
|
|
|
+ @click="buyNow(true, $event)">
|
|
|
+ <span class="watch">立即购买</span>
|
|
|
+ </button>
|
|
|
+ <button style="z-index: 1000;"
|
|
|
+ ref="addCartBtn"
|
|
|
+ class="btn btn-add-cart"
|
|
|
+ @mouseenter="setHoverStyle(true)"
|
|
|
+ @mouseleave="setHoverStyle(false)"
|
|
|
+ :style="btnColor ? `color:${btnColor};border-color:${btnColor};` : ''"
|
|
|
+ :class="{'disabled': disabledFlag}"
|
|
|
+ @click="buyNow(false, $event)">
|
|
|
+ <span class="watch">加入购物车</span>
|
|
|
+ </button>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- props: ['item', 'disabledFlag'],
|
|
|
+ props: ['item', 'disabledFlag', 'btnColor'],
|
|
|
methods: {
|
|
|
buyNow: function (isBuy, event) {
|
|
|
event.stopPropagation()
|
|
|
@@ -91,6 +106,12 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ setHoverStyle: function (isShow) {
|
|
|
+ if (this.btnColor) {
|
|
|
+ this.$refs.addCartBtn.style.color = isShow ? '#fff' : this.btnColor
|
|
|
+ this.$refs.addCartBtn.style.background = isShow ? this.btnColor : '#fff'
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|