liveActionButtons.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="live-action-buttons" :class="'live-action-buttons--' + size">
  3. <view class="live-action-buttons__item live-action-buttons__item--more" @click.stop="handleMore">
  4. <image class="live-action-buttons__more-icon" :src="moreIconSrc" mode="aspectFit" />
  5. </view>
  6. <view class="live-action-buttons__item live-action-buttons__item--cart" @click.stop="handleCart">
  7. <image class="live-action-buttons__cart-icon" :src="cartIconSrc" mode="aspectFit" />
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. const MORE_ICON_VERTICAL =
  13. 'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/more-icon.png';
  14. const MORE_ICON_HORIZONTAL = '/static/images/live/more2.png';
  15. const CART_ICON =
  16. 'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/fs/20251231/8376c769d7154f04b13cbec4a76bacf0.png';
  17. export default {
  18. name: 'LiveActionButtons',
  19. props: {
  20. showType: {
  21. type: Number,
  22. default: 2
  23. },
  24. // normal:聊天栏小图标;large:竖屏视频叠加层大图标
  25. size: {
  26. type: String,
  27. default: 'normal'
  28. }
  29. },
  30. computed: {
  31. moreIconSrc() {
  32. return this.showType === 1 ? MORE_ICON_HORIZONTAL : MORE_ICON_VERTICAL;
  33. },
  34. cartIconSrc() {
  35. return CART_ICON;
  36. }
  37. },
  38. methods: {
  39. handleMore() {
  40. this.$emit('more');
  41. },
  42. handleCart() {
  43. this.$emit('cart');
  44. }
  45. }
  46. };
  47. </script>
  48. <style scoped lang="scss">
  49. .live-action-buttons {
  50. display: flex;
  51. flex-direction: row;
  52. align-items: center;
  53. flex-shrink: 0;
  54. }
  55. .live-action-buttons__item {
  56. display: flex;
  57. align-items: center;
  58. justify-content: center;
  59. }
  60. .live-action-buttons--normal {
  61. justify-content: flex-end;
  62. .live-action-buttons__item--more {
  63. margin-right: 40rpx;
  64. }
  65. .live-action-buttons__item--cart {
  66. margin-right: 20rpx;
  67. }
  68. .live-action-buttons__more-icon {
  69. width: 48rpx;
  70. height: 48rpx;
  71. }
  72. .live-action-buttons__cart-icon {
  73. width: 46rpx;
  74. height: 58rpx;
  75. }
  76. }
  77. .live-action-buttons--large {
  78. .live-action-buttons__item + .live-action-buttons__item {
  79. margin-left: 16rpx;
  80. }
  81. .live-action-buttons__more-icon,
  82. .live-action-buttons__cart-icon {
  83. width: 88rpx;
  84. height: 88rpx;
  85. }
  86. }
  87. </style>