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>
相关推荐
LEE8 分钟前
前端转型全栈 03:接口失败也返回 200,OpenAPI 契约与错误码怎么定
前端·后端·全栈
扶苏100216 分钟前
CSS 图标换色指南:用 brightness / invert / mask 把任意图片改成想要的颜色
css
我命由我1234534 分钟前
CSS - CSS 媒体查询 orientation
前端·javascript·css·html·css3·html5·js
lichenyang4531 小时前
让 VK 小程序调用 HarmonyOS 原生能力:一次跨端 Bridge SDK 的设计与实践
前端
阳光宅男@李光熠1 小时前
【电子通识】一起学习TDK的EMC基础——电池兼容设计方法概述
java·前端·数据库
南雨北斗2 小时前
vue3项目中的env.d.ts文件
前端
烈风逍遥2 小时前
第五篇:通用 LLM 流式对话:前后端联接的完整实现
前端·后端·架构
aixingpan2 小时前
aixingpan.cn API开发文档:api_docs_trichart_natal_progression_sec_transit2接口指南
前端·php
江华森2 小时前
Web 安全实战:验证机制、会话管理、SQL 注入、XSS 与 CSRF
前端
江华森2 小时前
HTTPS 实战:TLS 握手成本、自制 CA 与证书、三大常见故障
前端