CateTwo.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div :class="['qn-page-' + theme]">
  3. <scroll-view scroll-y class="cate-ul clearfix" :style="{ height: 'calc(100vh - 112rpx - ' + (isBang ? '84px' : '50px') + ')' }">
  4. <view class="cate-li" v-for="(item, index) in cate_list" :key="index" @click="goPage('/pagesT/productDetail/productDetail?id=' + item.id + '&name=' + item.title)">
  5. <view class="cate-img-view"><image :src="item.images" mode="aspectFill" class="cate-img"></image></view>
  6. <view class="cate-tit">{{ item.title }}</view>
  7. </view>
  8. </scroll-view>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. cate_list: []
  16. };
  17. },
  18. computed: {
  19. userId() {
  20. return this.$store.state.userStatus.id;
  21. }
  22. },
  23. created() {
  24. this.getAllCategory();
  25. },
  26. methods: {
  27. // 分类列表 getAllCategory
  28. getAllCategory() {
  29. this.$u.api
  30. .getAllCategory({
  31. userCenterId: this.userId || 0
  32. })
  33. .then(data => {
  34. this.cate_list = data.data;
  35. });
  36. }
  37. }
  38. };
  39. </script>
  40. <style lang="scss">
  41. .cate-ul {
  42. /* #ifdef H5||MP */
  43. height: calc(100vh - 230upx);
  44. /*#endif*/
  45. /* #ifdef APP-PLUS */
  46. height: calc(100vh - 100upx);
  47. /*#endif*/
  48. .cate-li {
  49. float: left;
  50. width: 150upx;
  51. margin-left: 72upx;
  52. text-align: center;
  53. margin-top: 50upx;
  54. .cate-img-view {
  55. width: 150upx;
  56. height: 150upx;
  57. background-color: #f4f5f6;
  58. border-radius: 8rpx;
  59. overflow: hidden;
  60. .cate-img {
  61. width: 150upx;
  62. height: 150upx;
  63. display: block;
  64. }
  65. }
  66. .cate-tit {
  67. font-size: 28upx;
  68. color: #333;
  69. padding-top: 20upx;
  70. }
  71. }
  72. }
  73. </style>