123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <view class="menu-content">
- <uv-vtabs :chain="chain" :list="list" :height="height">
- <template v-for="(item,index) in list">
- <uv-vtabs-item :index="index" :key="index">
- <view class="menu-box">
- <view class="menu-title">{{item.name}}</view>
- <view class="menu-list">
- <view class="menu-item" @click="toCategory(item)">
- <image class="item-menu-image" :src="shopImage(item.icon)" mode="scaleToFill"></image>
- <view class="item-menu-name">{{item.name}}</view>
- </view>
- <view class="menu-item" v-for="(item1, index1) in item.children" :key="index1"
- @click="toCategory(item1)">
- <image class="item-menu-image" :src="shopImage(item.icon)" mode=""></image>
- <view class="item-menu-name">{{item.name}}</view>
- </view>
- </view>
- </view>
- </uv-vtabs-item>
- </template>
- </uv-vtabs>
- </view>
- </template>
- <script>
- import {
- getCategoryList
- } from '@/request/api/shop.js'
- export default {
- data() {
- return {
- list: [],
- chain: true
- }
- },
- computed: {
- height() {
- return uni.getWindowInfo().windowHeight - uni.upx2px(100);
- }
- },
- onLoad() {
- this.init();
- },
- methods: {
- async init() {
- let categoryData = await getCategoryList();
- if (categoryData.state) this.list = categoryData.data;
- },
- toCategory(item) {
- this.$navigateTo('/subPages/shopPage/menuShop/menuShop?idCategory=' + item.id);
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .menu-content {
- padding-top: 30rpx;
- }
- .menu-box {
- padding: 20rpx;
- .menu-title {
- font-size: 36rpx;
- font-weight: bold;
- padding-bottom: 20rpx;
- }
- }
- .item-menu-image {
- width: 120rpx;
- height: 120rpx;
- }
- .item-menu-name {
- font-weight: normal;
- font-size: 24rpx;
- }
- .menu-list {
- display: flex;
- flex-wrap: wrap;
- .menu-item {
- width: 33.33%;
- text-align: center;
- }
- }
- </style>
|