cashier_app/pages/appliccation/list.vue

78 lines
1.7 KiB
Vue

<template>
<view class="u-p-30 bg-gray min-page">
<view class=" border-r-16 bg-fff u-p-30 " >
<view class="u-m-t-32">
<up-grid :border="false" col="2">
<up-grid-item @click="toPage(listItem,listIndex)" v-for="(listItem,listIndex) in computedMenus"
:key="listIndex">
<image style="width: 120rpx;height: 120rpx;" :src="listItem.miniIcon" mode="scaleToFill" />
<text class="u-m-t-16 color-333 u-font-28 u-p-b-32">{{listItem.title}}</text>
</up-grid-item>
</up-grid>
</view>
</view>
</view>
</template>
<script setup>
import {
computed
} from 'vue';
import go from '@/commons/utils/go.js';
import {
useMenusStore
} from '@/store/menus.js';
const menusStore = useMenusStore()
async function init() {
const res = await menusStore.getMenus()
}
init()
function toPage(item, index) {
console.log(item);
uni.navigateTo({
url: '/' + item.miniPath.replace(/^\/+|\/+$/g, ''),
fail(err) {
uni.showToast({
icon: 'none',
title: '无该页面路径或无权限访问该页面'
})
}
})
}
const navList = [{
title: '存酒',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX'
},
{
title: '点歌',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX'
},
{
title: '广告',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX'
},
{
title: '叫号',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX'
},
];
const computedMenus = computed(() => {
const arr= menusStore.adminPages.filter(v=>{
return navList.find(navItem=>navItem.title==v.title)
})
console.log(arr);
return arr
})
</script>
<style lang="scss">
</style>