index.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="index">
  3. <!-- section -->
  4. <view class="section">
  5. <view v-for="(item, index) in 5" :key="index" class="item padding bg-white ">
  6. <view class="flex">
  7. <view style="width: 20upx;background-color: #4d6bab;" class="margin-right-xs"></view>
  8. <view style="flex: auto; background-image: linear-gradient(120deg,#4d6bab 0%, #fff 80%);" class="padding-tb-sm text-white bg-white padding-left-sm">商品分类</view>
  9. </view>
  10. <view class="content padding-tb flex flex-wrap align-center">
  11. <view @click="handler" v-for="(it, ind) in 5" :key="ind" class="content-item margin-bottom" style="width: calc(100vw / 3 - 40upx);border-radius: 20upx;overflow: hidden;">
  12. <image
  13. style="width: calc(100vw / 3 - 40upx);height: calc(100vw / 3 - 40upx);"
  14. lazy-load="true"
  15. src="https://gd-hbimg.huaban.com/d478a9c4bd0167adae79806c6ccaa2d7f59ded5dd101-WmmTdI_fw658/format/webp"
  16. mode="aspectFit"
  17. ></image>
  18. <view class="padding-xs">
  19. <view class="name text-black">前端运行日志,请另行在小程序开发工具的控制台查看</view>
  20. <view class="text-gray">销量:1000</view>
  21. <view class="flex justify-between">
  22. <view class="text-red text-price">
  23. <cu-price value="100" size="32" />
  24. </view>
  25. <text class="cuIcon-cart text-xl"></text>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- footer -->
  33. <cu-bar active="0" />
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {};
  40. },
  41. onLoad() {},
  42. methods: {
  43. handler() {
  44. uni.navigateTo({
  45. url: '/pages/detail/index'
  46. });
  47. }
  48. },
  49. onShareAppMessage() {
  50. return {};
  51. },
  52. onShareTimeline() {
  53. return {};
  54. }
  55. };
  56. </script>
  57. <style lang="scss" scoped>
  58. .index {
  59. .section {
  60. .item {
  61. .content {
  62. .content-item{
  63. margin-right: 30upx;
  64. image{
  65. vertical-align: top;
  66. }
  67. .name{
  68. text-align: justify;
  69. display: -webkit-box;
  70. overflow: hidden;
  71. text-overflow: ellipsis;
  72. -webkit-line-clamp: 2;
  73. -webkit-box-orient: vertical;
  74. }
  75. }
  76. .content-item:nth-child(3n) {
  77. margin-right: 0;
  78. }
  79. }
  80. }
  81. }
  82. }
  83. </style>