index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="commodity">
  3. <!-- header -->
  4. <cu-custom custom bgColor="bg-gradual-blue"><view slot="content">商品列表</view></cu-custom>
  5. <!-- section -->
  6. <cu-treeSelectB @change="changeSelect" :value="label" :height="height">
  7. <view class="section-right">
  8. <view class="item bg-white radius padding flex margin-tb-sm">
  9. <!-- 图片 -->
  10. <image lazy-load="true" class="image radius margin-right-sm" src="https://gd-hbimg.huaban.com/d478a9c4bd0167adae79806c6ccaa2d7f59ded5dd101-WmmTdI_fw658/format/webp" mode="aspectFit"></image>
  11. <view class="content">
  12. <view class="text-xl">商品名称</view>
  13. <view class="text-gray">
  14. 销量:1000
  15. </view>
  16. <view class="text-red">¥<cu-price value="100" size="32" /></view>
  17. <view class="cart">
  18. <text class="cuIcon-cart text-xl"></text>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </cu-treeSelectB>
  24. <!-- footer -->
  25. <cu-bar active="1" />
  26. </view>
  27. </template>
  28. <script>
  29. import { CustomBarHeight } from '@/common/device/index.js';
  30. export default {
  31. data() {
  32. return {
  33. label: []
  34. };
  35. },
  36. computed: {
  37. height() {
  38. return `calc(100vh - 100rpx - ${CustomBarHeight}px)`;
  39. }
  40. },
  41. onLoad() {
  42. let label = [];
  43. for (var i = 0; i < 20; i++) {
  44. label.push({ label: 'Tab-' + i, id: i });
  45. }
  46. this.label = label;
  47. },
  48. methods: {
  49. changeSelect(item) {
  50. console.log(item);
  51. }
  52. },
  53. onShareAppMessage() {
  54. return {};
  55. },
  56. onShareTimeline() {
  57. return {};
  58. }
  59. };
  60. </script>
  61. <style lang="scss" scoped>
  62. .section-right {
  63. .item {
  64. .image {
  65. width: 160upx;
  66. min-width: 160upx;
  67. height: 160upx;
  68. background-size: cover;
  69. background-position: center;
  70. }
  71. .content{
  72. flex: auto;
  73. .cart{
  74. float: right;
  75. }
  76. }
  77. }
  78. }
  79. </style>