| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <template>
- <view class="channel-entry" v-if="list && list.length > 0">
- <view class="channel-grid-wrap">
- <view class="channel-grid">
- <view class="channel-item" v-for="(item, ci) in list" :key="item.id || ci" @tap="onClick(item)">
- <image class="channel-icon" :src="item.icon || item.imageUrl" mode="aspectFill"></image>
- <text class="channel-name">{{ item.categoryName || item.name || item.menuName }}</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'ChannelEntry',
- props: {
- list: { type: Array, default: () => [] },
- perRow: { type: Number, default: 4 },
- rows: { type: Number, default: 2 },
- imgSize: { type: Number, default: 88 }
- },
- methods: {
- onClick(item) {
- this.$emit('click', item);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .channel-entry {
- background: #fff;
- padding: 24rpx 0 32rpx;
- }
- .channel-grid-wrap {
- padding: 0 24rpx;
- }
- .channel-grid {
- display: flex;
- flex-wrap: wrap;
- }
- .channel-item {
- width: 25%;
- display: flex;
- flex-direction: column;
- align-items: center;
- padding-bottom: 28rpx;
- box-sizing: border-box;
- }
- .channel-icon {
- width: 96rpx;
- height: 96rpx;
- border-radius: 50%;
- margin-bottom: 12rpx;
- background: #f5f5f5;
- }
- .channel-name {
- font-size: 24rpx;
- color: #333;
- text-align: center;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- max-width: 100%;
- }
- </style>
|