index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="index">
  3. <!-- section -->
  4. <view class="section flex justify-center flex-wrap">
  5. <view @click="handler" v-for="(item, index) in 10" :key="index" class="item bg-white radius padding">
  6. <image lazy-load="true" src="https://gd-hbimg.huaban.com/d478a9c4bd0167adae79806c6ccaa2d7f59ded5dd101-WmmTdI_fw658/format/webp" mode="aspectFit"></image>
  7. <view class="text-xl">商品名称</view>
  8. <view class="text-gray">销量:1000</view>
  9. <view class="flex justify-between">
  10. <view class="text-red text-price">
  11. <cu-price value="100" size="32" />
  12. </view>
  13. <text class="cuIcon-cart text-xl"></text>
  14. </view>
  15. </view>
  16. </view>
  17. <!-- footer -->
  18. <cu-bar active="0" />
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {};
  25. },
  26. onLoad() {},
  27. methods: {
  28. handler(){
  29. uni.navigateTo({
  30. url:"/pages/detail/index"
  31. })
  32. }
  33. },
  34. onShareAppMessage() {
  35. return {};
  36. },
  37. onShareTimeline() {
  38. return {};
  39. }
  40. };
  41. </script>
  42. <style lang="scss" scoped>
  43. .index {
  44. .section {
  45. .item {
  46. width: calc(50vw - 60upx);
  47. box-sizing: border-box;
  48. margin: 15upx 30upx;
  49. image{
  50. width: calc(50vw - 60upx);
  51. height: calc(50vw - 60upx);
  52. }
  53. }
  54. .item:nth-child(2n + 1) {
  55. margin-left: 15upx;
  56. }
  57. .item:nth-child(2n + 1) {
  58. margin-right: 15upx;
  59. }
  60. }
  61. }
  62. </style>