zyejMAll-mobile/sheep/components/s-menu-grid/s-menu-grid.vue

81 lines
1.9 KiB
Vue
Raw Normal View History

2024-08-07 10:31:42 +08:00
<!-- 装修基础组件宫格导航 -->
<template>
2024-10-14 19:12:22 +08:00
<uni-grid :showBorder="Boolean(data.border)" :column="data.column">
2024-10-16 18:09:51 +08:00
<uni-grid-item v-for="(item, index) in data.list" :key="index" @tap="sheep.$router.go(item.url)" :class="data.list.length > 5 ? 'sss' : ''">
2024-10-14 19:12:22 +08:00
<view class="grid-item-box ss-flex ss-flex-col ss-row-center ss-col-center">
<view class="img-box">
<view class="tag-box" v-if="item.badge.show"
:style="[{ background: item.badge.bgColor, color: item.badge.textColor }]">
{{ item.badge.text }}
</view>
<image class="menu-image" :src="sheep.$url.cdn(item.iconUrl)"></image>
</view>
2024-08-07 10:31:42 +08:00
2024-10-14 19:12:22 +08:00
<view class="title-box ss-flex ss-flex-col ss-row-center ss-col-center">
2024-10-16 18:09:51 +08:00
<view class="grid-text" :style="[{ color: item.titleColor }]" style="font-size: 12px;">
2024-10-14 19:12:22 +08:00
{{ item.title }}
</view>
<view class="grid-tip" :style="[{ color: item.subtitleColor }]">
{{ item.subtitle }}
</view>
</view>
</view>
</uni-grid-item>
</uni-grid>
2024-08-07 10:31:42 +08:00
</template>
<script setup>
2024-10-14 19:12:22 +08:00
import sheep from '@/sheep';
2024-08-07 10:31:42 +08:00
2024-10-14 19:12:22 +08:00
const props = defineProps({
data: {
type: Object,
default () {},
},
});
2024-08-07 10:31:42 +08:00
</script>
<style lang="scss" scoped>
2024-10-16 18:09:51 +08:00
:deep(.sss:not(:nth-child(n+6))){
margin-bottom: 15px;
}
2024-10-14 19:12:22 +08:00
.menu-image {
width: 45px;
height: 45px;
}
2024-08-07 10:31:42 +08:00
2024-10-14 19:12:22 +08:00
.grid-item-box {
// flex: 1;
// display: flex;
// flex-direction: column;
// align-items: center;
// justify-content: center;
// height: 100%;
.img-box {
position: relative;
.tag-box {
position: absolute;
z-index: 2;
top: 0;
right: 0;
font-size: 2em;
line-height: 1;
padding: 0.4em 0.6em 0.3em;
transform: scale(0.4) translateX(0.5em) translatey(-0.6em);
transform-origin: 100% 0;
border-radius: 200rpx;
white-space: nowrap;
}
}
.title-box {
.grid-tip {
font-size: 24rpx;
white-space: nowrap;
text-align: center;
}
}
}
</style>