当前位置: 首页 > news >正文

uniapp——列表选择样式

案例

在这里插入图片描述

代码

<view class="list"><block v-for="(item,index) in 8" :key="index"><view class="item" @click="choosePackage(item)" :class="{'active':item == current}"><view class="i_money"><text class="i_num">2</text></view><view class="i_txt">套餐</view></view></block>
</view>
export default {components: {},data() {return {current: 0,};},watch: {},onLoad() {},onShow() {},methods: {choosePackage(item) {console.log(item);this.current = item}}
}
.list {margin-top: 44rpx;display: grid;grid-template-columns: repeat(3, 1fr);grid-gap: 16px 14px; //行间距 列间距.item {background: #FFFFFF;border-radius: 10rpx 10rpx 10rpx 10rpx;border: 1rpx solid #BCBCBC;display: flex;flex-direction: column;justify-content: center;align-items: center;padding: 20rpx 0;.i_money {font-weight: bold;font-size: 22rpx;color: #292929;.i_num {font-size: 30rpx;}}.i_txt {font-size: 22rpx;color: #292929;margin-top: 5rpx;}}.active {background: #FFFDFA;border: 1rpx solid #FE8300;position: relative;}.active::before {content: '';position: absolute;right: 5rpx;top: 6rpx;width: 12rpx;height: 9rpx;border-right: 2rpx solid #FFFFFF;border-top: 2rpx solid #FFFFFF;transform: rotate(135deg);z-index: 2;}.active::after {content: '';position: absolute;right: 0;top: 0;border-radius: 0 6rpx 0 10rpx;width: 26rpx;height: 26rpx;background-color: #FE8300;}}
http://www.lryc.cn/news/423032.html

相关文章:

  • 解决客户访问超时1s问题
  • Linux命令(基础面试可用,都是自己觉得平时使用多的)
  • opencv-python图像增强一:传统图像去噪方法整理
  • Canal单机部署
  • java,每日练习02
  • C# TreeView
  • 通过xshell使用密钥连接阿里云服务器
  • <数据集>路面坑洼识别数据集<目标检测>
  • 几个常用脚本
  • gtest中TEST和TEST_F和TEST_P的区别是什么
  • VS2022如何调出输出窗口,并在输出窗口打印日志
  • 【全国大学生电子设计竞赛】2021年I题
  • 【项目】基于Vue2+Router+Vant 前端面经项目
  • 【论文阅读】YOLOv10: Real-Time End-to-End Object Detection
  • 计算资源消耗
  • 企业微信推送消息的Java实现教程
  • 强化学习之Actor-Critic算法(基于值函数和策略的结合)——以CartPole环境为例
  • Linux学习记录(五)-------三类读写函数
  • 2024年8月13日(lvs NAT脚本 RS脚本 ds脚本)
  • css实现水滴效果图
  • 接口测试面试题目,你都会了吗?
  • jmeter-beanshell学习16-自定义函数
  • LogicFlow工作流在React和Vue3中的使用
  • Python循环语句:不到长城心不死
  • Unity教程(九)角色攻击的改进
  • 宠物空气净化器真的能除毛吗?有哪些选购技巧和品牌推荐修改版
  • Qt自定义注释
  • 【模电笔记】——信号的运算和处理电路(含电压比较器)
  • Java之 equals()与==
  • Ubuntu20.04 运行深蓝路径规划hw1