小程序列表展示

article/2025/11/6 12:21:46

小程序列表展示

wxml代码

<view class="content"><form catchsubmit="formSuos" catchreset="formReset"><view class="group"><view class="sous"><input class="text1_3" auto-focus placeholder="群名称,如:王者" name="wxname"/><button type="default" formType="submit">a</button><icon class="icon-small" type="search" size="35" color="#4949ea"></icon></view></view>
</form><view class="chax"><scroll-view class="scroll" scroll-y="true" ><view class="box {{item.checked?'bacor':''}}"  data-id='{{item._id}}' data-data='{{buttons}}' bindtap='radioButtonTap'  wx:for="{{buttons}}">{{item.name}}</view>
</scroll-view><scroll-view class="qunfu" scroll-y="true"><!-- 先展示置顶信息 --><view class="qunfu_gro" wx:for="{{array}}"><view class="qunfu_lie"><view class="qunfu_img"> <image src="/images/banner1.jpg"></image><image class="zhidt" src="/image/zhiding.png" ></image></view><view class="qunfu_youx"><text class="text1">测试{{index+1}}</text><text class="text2">长沙市</text><view class="text3"><text class="text3_1">游戏</text><text class="text3_2">2021</text></view></view></view></view><view class="sswz" wx:if="{{data==''}}">未查询到您想要的值</view></scroll-view></view></view>

js代码

这里我用的的是云函数读取数据

页面
在这里插入图片描述

Page({/*** 页面的初始数据*/data: {array:15,buttons: [{ id: 1, name: '银色' }, { id: 2, name: '白色' }, { id: 3, name: '黑色' },{ id: 4, name: '红色' },{ id: 5, name: '绿色' },{ id: 6, name: '蓝色' }],},/*** 生命周期函数--监听页面加载*/onLoad: function (options) {const db=wx.cloud.database();//与数据库fenleidb.collection('fenlei').get().then(ret=>{console.log('第二种方式获取成功',ret);//初次加载页面,赋值第一个为trueret.data[0].checked = true;this.setData({buttons:  ret.data})}).catch(err=>{console.log('第二种方式获取失败',ret);}) console.log(this.data.buttons)},//点击不同值时radioButtonTap: function (e) {console.log(e)const that=this;let id = e.currentTarget.dataset.idlet data = e.currentTarget.dataset.data//数组console.log(data);for (let i = 0; i < data.length; i++) {if (data[i]._id == id) {//当前点击的位置为true即选中data[i].checked = true;}else {//其他的位置为falsedata[i].checked = false;}}that.setData({buttons:data})},onPullDownRefresh: function () {//当下拉刷新加载完值,停止刷新wx.stopPullDownRefresh()},})

wxas代码

.content{background: whitesmoke;
}.chax{display: flex;
}.scroll{padding: 0; width: 200rpx; height: 1270rpx;}/*white-space: nowrap;不可以换行*/
.scroll .box{text-align: center; width: 90%;margin-left: 8rpx;    border-bottom: 1px solid rgb(227, 228, 229);}
.scroll image{width: 100rpx;height: 100rpx;}
.scroll view{font-size: 28rpx;padding: 30rpx 0;}
.scroll .bacor{  background: white; color: #4949ea; }.scroll .bacor::before{    width: 8rpx;height: 30rpx;background: #4949ea;display: block;content: '';position: relative;left: 30rpx;top: 35rpx;margin-top: -30rpx;}/*content: ''定义为空才会显示红斜线*/
/* 列表 */.group {display: flex;align-items: center;justify-content: space-around;height: 150rpx;background: white;border-bottom: 1rpx solid whitesmoke;
}
.sous {display: flex;justify-content: space-between;align-items: center;width: 650rpx;height: 80rpx;text-align: center;line-height: 80rpx;border-radius: 15rpx;border: 2rpx solid rgb(227, 228, 229);
}
.sous picker {position: relative;background: #4949ea;width: 130rpx;height: 100%;font-size: 36rpx;color: white;border-top-left-radius: 15rpx;border-bottom-left-radius: 15rpx;border-right: 2rpx solid rgb(227, 228, 229);
}
.sous input {padding-left: 10rpx;text-align: left;font-size: 36rpx;
}
.sous button {position: absolute;right: 0;opacity: 0;
}
.sous icon {height: 100%;
}.qunfu{background: white;width: 540rpx;margin: 0 auto;margin-left: -8rpx;height: 1270rpx;}
.qunfu .qunfu_gro{display: flex;justify-content: space-between;align-items: center;border-bottom: 1px solid whitesmoke;
}.qunfu_lie{display: flex;padding: 25rpx 0 0 20rpx;
}
.qunfu_lie .qunfu_img{position: relative;
}
.qunfu_lie .qunfu_img image{width: 150rpx;height: 150rpx;
}
.qunfu .sswz {text-align: center;height: 1000rpx;padding-top: 20rpx;font-size: 32rpx;color: #666;
}
.qunfu_lie .qunfu_img .zhidt{position: absolute;left: 0;width: 100rpx;height: 100rpx;
}.qunfu_lie .qunfu_youx{display: flex;flex-direction: column;padding-left: 10rpx;line-height: 48rpx;
}.qunfu_youx .text1{font-size: 32rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 240rpx;
}
.qunfu_youx .text2{font-size: 28rpx;color: #666;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 240rpx;
}
.qunfu_youx .text3{display: flex;
}
.qunfu_youx .text3 .text3_1{font-size: 22rpx;width: 120rpx;height: 40rpx;line-height: 40rpx;border: 1rpx solid #4949ea;text-align: center;color: #4949ea;border-radius: 5rpx;margin-right: 20rpx;
}.qunfu_youx .text3 .text3_2{font-size: 22rpx;width: 160rpx;height: 40rpx;line-height: 40rpx;border: 1rpx solid #4949ea;text-align: center;color: #4949ea;border-radius: 5rpx;
}.jiaqun{position: relative;right: 20rpx;width: 130rpx;height: 50rpx;background: #4949ea;border-radius: 50rpx;text-align: center;line-height: 50rpx;
}
.jiaqun1{background: #666;
}
.jiaqun text{color: white;font-size: 28rpx;
}

json代码

{"navigationBarTitleText":"日志","enablePullDownRefresh": true,"backgroundColor":"#d3d3d3","backgroundTextStyle":"dark"
}

http://chatgpt.dhexx.cn/article/fn2AQI02.shtml

相关文章

微信小程序信息展示列表

微信小程序信息展示列表 效果展示: 代码展示: wxml <view class"head"><view class"head_item">分类</view><view class"ring"></view><view class"head_item">价格</view> </view>…

微信小程序-列表展示、条目点击。

直接贴图&#xff1a; wx:for"{{datas}}"设置数据源&#xff1b; wx:for-item"item"设置条目名称&#xff1b; data-index{{index}}设置角标。 bindtapitemClick点击事件。 {{item.item}}显示数据 datas数据源。 条目点击 itemClick: function(e) { …

【微信小程序】-- 案例 - 本地生活(列表页面)(三十)

&#x1f48c; 所属专栏&#xff1a;【微信小程序开发教程】 &#x1f600; 作  者&#xff1a;我是夜阑的狗&#x1f436; &#x1f680; 个人简介&#xff1a;一个正在努力学技术的CV工程师&#xff0c;专注基础和实战分享 &#xff0c;欢迎咨询&#xff01; &…

微信小程序删除list指定列表项

一、删除效果展示&#xff1a; // 重要代码片段async deleteListItem(e) {const sureResult await wx.showModal({title: "提示",content: "确定要删除这项吗",});if (sureResult.confirm) {const { index } e.currentTarget.dataset;setTimeout(()>{…

【小程序从0到1】小程序常用组件一览

欢迎来到我的博客 &#x1f4d4;博主是一名大学在读本科生&#xff0c;主要学习方向是前端。 &#x1f36d;目前已经更新了【Vue】、【React–从基础到实战】、【TypeScript】等等系列专栏 &#x1f6e0;目前正在学习的是&#x1f525; R e a c t / 小程序 React/小程序 React/…

微信小程序商城系列之商品列表页(一)

微信小程序商城列表页 wxml: <view classlist><block wx:for{{dataList}} wx:keylist wx:for-item"item"><view class"list_item"><navigator urldetails?id{{item.goods_id}}><view classimg><image src"{{imghr…

微信小程序——商品列表

主页面 <view class"container"><googsList goodsClassList"{{goodsClassList}}" goodsList"{{goodsList}}" bind:leftClick"leftClick" bind:toDetails"toDetails" bind:scrolltolowerGoodsClass"scroll…

微信小程序 - 商城项目 - 列表排序

sort ( ) 排序 需要实现两个排序功能&#xff0c;价格排序和好评排序&#xff0c;且都可以正反切换 数字比较 价格排序中&#xff0c;价格为数字类型&#xff0c;属于数字的比较&#xff0c;无需转换类型 // 点击价格排序的图标handlePrice(){this.setData({priceOrder:!this…

微信小程序之多列表的显示和隐藏功能【附源码】

效果图&#xff1a; 实现思路&#xff1a; 实现单个列表的显示和隐藏应该使用唯一元素让程序知道你应该显示和隐藏哪个列表项&#xff0c;可以用数据的id&#xff1b;css中定义一个hidden{display&#xff1a;none}控制显示和隐藏&#xff0c;然后通过三元运算符来判断&#x…

微信小程序列表实现

1.在 .json文件中使用 navigationBarTitleText定义当前窗口title {"navigationBarTitleText": "小程序列表实现" }2.在 .wxss文件中编写如下&#xff1a; // page设置当前窗口背景色 page{background-color: #F5F5F5 }// 定义.container设置容器样式 .co…

微信小程序 开发列表

一.知识点 (一).列表渲染 wx:for tip:wx:for“array”可以等于参数名&#xff0c;在js中调用 Page({ data:{ array: [{name: 小李},{ name: 小高}]} })&#xff0c;获取值&#xff1b;也可以直接把wx:for"{{[1, 2, 3]}}"&#xff0c;把值放在上面 1.在组件上使用wx:f…

微信小程序实现分类列表

1、效果展示 2、fenleiliebiao.wxml文件代码 <!-- 头部搜索 --> <view class"title_search"></view> <!-- 头部搜索 --> <!-- Tab布局 --> <view catchtouchmovetrue><view classnavBox><view classtitleBox1 id"…

微信小程序--数据列表

设置页面标题 首页可以使用&#xff1a; app.json中window对象的"navigationBarTitleText"参数进行标题设置&#xff0c; 每个页面也可以在对应json文件中使用"navigationBarTitleText"参数进行标题设置 也可以在js文件的onRead函数中使用&#xff1a;js中…

用小程序完成简单的详情列表功能

最近学习了微信小程序&#xff0c;写了一个详情列表 主要思路是&#xff1a; 1.先通过接口拿到数据&#xff0c;在onLoad(options){}中调用wx.request(){}函数&#xff0c;获取到数据 2.完成数据渲染后&#xff0c;&#xff0c;用catchtab给它绑定一个点击事件&#xff0c;点…

微信小程序--列表展示

小知识&#xff1a; wx:for"{{list}}"用来循环数组。 wx:for-item‘变量名&#xff08;随便起&#xff09;’ 它是指定循环数据当前的变量名&#xff0c;可以通过 {{变量名.属性}} 展示数组的元素。 wx:for-index‘变量名&#xff08;随便起&#xff09;’&#x…

vmware 下 ubuntu 双网卡设置

写在前面&#xff1a; 本文章旨在总结备份、方便以后查询&#xff0c;由于是个人总结&#xff0c;如有不对&#xff0c;欢迎指正&#xff1b;另外&#xff0c;内容大部分来自网络、书籍、和各类手册&#xff0c;如若侵权请告知&#xff0c;马上删帖致歉。 目录 step 1&#xf…

Ubuntu18.04 配置网卡

2019/10/29, Ubuntu Server 18.04 摘要&#xff1a;Ubuntu Server 18.04 采用netplan作为网络配置管理&#xff0c;修改IP使其连上网络&#xff0c;修改替换软件源 修改网卡配置# 首先使用ip a查看当前网卡名称&#xff1a; 可以看到eth0就是我们的网卡名称&#xff0c;这个要…

linux Ubuntu网卡配置,Windows 7下用VirtualBox安装Ubuntu网卡配置

Windows 7下用VirtualBox安装Ubuntu&#xff0c;要求Ubuntu能连上互联网&#xff0c;同时在Ubuntu中配置SSH、FTP、NFS服务&#xff0c;能从Win7进行访问。 此时Linux虚拟机需要两块网卡&#xff0c;一块使用NAT方式(网络地址翻译网络)连接&#xff0c;用于连接互联网&#xff…

Ubuntu 双网卡配置优先级

Ubuntu 双网卡配置优先级 作者&#xff1a;Bright Xu Ubuntu的网卡配置跟CentOS不太一样。 更多请参考&#xff1a;CentOS 双网卡配置优先级 根据业务需要&#xff0c;有时候服务器需要两张网卡&#xff0c;一张用于访问外网&#xff0c;另一种用于连接内网。 如果在安装系统是…

ubuntu配置网卡

第一步&#xff1a;查看网卡信息 输入ifconfig命令查看网卡信息&#xff0c;下图红圈处就是网卡名称。 第二步&#xff1a;配置网卡文件 注意&#xff1a;不同的linux系统&#xff0c;网卡配置文件是不同的&#xff0c;这里ubuntu的网卡配置文件是/etc/network/interfaces。 输…