uniapp的小排版

javascript 复制代码
<template>
  <view class="prefix-home_center_class">
    <view class="prefix-container">
      <view v-for="(item, index) in navList" :key="index" class="prefix-item">
        <view :style="{ backgroundColor: item.color }" class="prefix-color-box"></view>
        <view class="prefix-font_icon">{{ item.class_name }}</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      navList: [
        { class_name: '海鲜水产', color: '#ff0000' },
        { class_name: '新鲜水果', color: '#00ff00' },
        { class_name: '优品鲜蔬', color: '#0000ff' },
        { class_name: '米面粮油', color: '#ffff00' },
        { class_name: '肉类蛋禽', color: '#ff00ff' },
        { class_name: '厨具用品', color: '#00ffff' },
        { class_name: '高等预制', color: '#999999' },
        { class_name: '奶制品', color: '#ff9999' },
        { class_name: '调味干货', color: '#99ff99' },
        { class_name: '药食同源', color: '#9999ff' }
      ]
    };
  },
  methods: {
    toGoodsList(item, index) {
      // Your method implementation here
    }
  }
};
</script>

<style>
.prefix-home_center_class {
  padding: 16rpx;
}

.prefix-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.prefix-item {
  width: 128rpx;
  height: 148rpx;
  background-color: #fff;
  border-radius: 16rpx;
  margin-bottom: 16rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.prefix-color-box {
  width: 60rpx;
  height: 60rpx;
  margin-bottom: 8rpx;
  border-radius: 8rpx;
}

.prefix-font_icon {
  font-size: 14rpx;
}
</style>
相关推荐
humcomm几秒前
AI编程对前端架构师技能的具体要求有哪些变化
前端·系统架构·ai编程
ZC跨境爬虫4 分钟前
跟着 MDN 学 HTML day_58:(构建行星数据表——HTML表格高级实战指南)
前端·javascript·ui·html·音视频
kyriewen8 分钟前
用户打开飞行模式都能打开你的网站?Service Worker 做离线缓存,PWA 实战
前端·javascript·面试
我是汪先生9 分钟前
学习 day8 memory
前端
栉甜19 分钟前
APIs学习
前端·javascript·css·学习·html
运营小白21 分钟前
2026 年 Shopify 关键词映射指南:从混乱到有序的实战经验
前端·一人公司·seonib·自动化内容·搜索流量
Dxy123931021628 分钟前
HTML的Iframe详解
前端·html
dsyyyyy110128 分钟前
CSS定位布局和网格布局
前端·css
码码哈哈0.041 分钟前
macos26 Liquid class 示例代码
前端