my-grid.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view>
  3. <van-grid column-num="2" :gutter="10">
  4. <!-- <van-grid-item icon="photo-o" text="冰美式">
  5. </van-grid-item>
  6. <van-grid-item icon="photo-o" text="古茗" />
  7. <van-grid-item icon="photo-o" text="白茶" />
  8. <van-grid-item icon="photo-o" text="热咖" /> -->
  9. <van-grid-item v-for="(item,idx) in grid_data" icon="photo-o" :text="item.text" :key="idx" :use-slot="true">
  10. <slot name="icon">
  11. <!-- <van-icon name="chat" color="red"></van-icon>-->
  12. <image src="@/static/logo.png" class="itemImg"></image>
  13. <!-- <van-image></van-image>-->
  14. </slot>
  15. <slot name="text" :item="item">
  16. <view v-if="idx%2" style="background-color: red">去摸鱼儿Isaac查看啊啊啊啊</view></slot>
  17. <view>描述信息:{{ item.description }}</view>
  18. </van-grid-item>
  19. </van-grid>
  20. <!-- 123-->
  21. <!-- <van-row gutter="20">-->
  22. <!-- <van-col span="20">-->
  23. <!--&lt;!&ndash; <my-grid-item></my-grid-item>&ndash;&gt;-->
  24. <!-- <view style="width: 40%">-->
  25. <!-- <image src="@/static/logo.png" style="width: 40%;height: auto"></image>-->
  26. <!-- 123-->
  27. <!-- </view>-->
  28. <!-- </van-col>-->
  29. <!-- <van-col span="20">-->
  30. <!-- <view style="width: 40%">-->
  31. <!-- <image src="@/static/logo.png"></image>-->
  32. <!-- 123-->
  33. <!-- </view>-->
  34. <!-- </van-col>-->
  35. <!-- </van-row>-->
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. grid_data:[{text:"冰美式"},{text:"古茗"},{text:"热咖"},{text:"白茶"},
  43. {text:"冰美式"},{text:"古茗"},{text:"热咖"},{text:"白茶"},
  44. {text:"冰美式"},{text:"古茗"},{text:"热咖"}]
  45. };
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. .itemImg{
  51. width: 250rpx;
  52. height: 170rpx;
  53. }
  54. </style>