klonButtom.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="klon-buttom">
  3. <view class="klon-frame">
  4. <button type="primary" class="klon-buy" @click="buy(1)" v-if="goodsObjact.stock > 0">
  5. <view class="klon-buyText">立即购买</view>
  6. </button>
  7. <button type="primary" class="klon-no" v-if="goodsObjact.stock < 1">
  8. <view class="klon-buyText">已售罄</view>
  9. </button>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. props: {
  16. goodsObjact: {
  17. type: Object,
  18. default: function () {
  19. return {
  20. }
  21. }
  22. },
  23. },
  24. data() {
  25. return {
  26. };
  27. },
  28. methods: {
  29. buy(data){
  30. this.$emit('buy',data)
  31. }
  32. }
  33. };
  34. </script>
  35. <style lang="scss">
  36. .klon-buttom {
  37. position: fixed;
  38. bottom: 0rpx;
  39. z-index: 95;
  40. display: flex;
  41. justify-content: center;
  42. align-items: center;
  43. width: 750rpx;
  44. height: 100rpx;
  45. padding: 10rpx 30rpx;
  46. background-color: #ffffff;
  47. .klon-frame {
  48. width: 100%;
  49. .klon-buy {
  50. border-radius: 100rpx;
  51. // background: linear-gradient(270deg, rgba(181,116,242, 1) 0%, rgba(139,86,254, 1) 100%);
  52. background:linear-gradient(14deg,rgba(255,116,37,1),rgba(255,30,41,1));
  53. }
  54. .klon-no {
  55. border-radius: 100rpx;
  56. background: #999999;
  57. }
  58. .klon-buyText {
  59. font-size: 34rpx;
  60. width: 100%;
  61. }
  62. }
  63. }
  64. </style>