当前位置:网站首页>小程序中的DOM对象元素块动态排序
小程序中的DOM对象元素块动态排序
2022-07-29 05:09:00 【晶格点阵】
给定以下小程序wxml的布局示例:
<view>
<view>A块中的内容,...</view>
<view>B块中的内容,...</view>
<view>C块中的内容,...</view>
<view>D块中的内容,...</view>
<view>E块中的内容,...</view>
</view>
按照新的要求,从不同的入口进入该界面,需要将不同的内容块显示在最前面,原来的需求已不能满足要求。
新的要求,当从“C块”入口点击进入该界面时,需要显示如下:
<view>
<view>C块中的内容,...</view>
<view>A块中的内容,...</view>
<view>B块中的内容,...</view>
<view>D块中的内容,...</view>
<view>E块中的内容,...</view>
</view>
如果是Jquery的话,可能比较好想出解决方案,直接操作DOM对象,将C块移动到最前面,但是,小程序不支持Jquery操作。
解决方案:
使用小程序wx:for循环显示所有块内容,定义一个列表:
items = ['A', 'B&
边栏推荐
- OCCT学习002-----环境搭建
- Together with digital people, digital space and XR platform, Alibaba cloud and its partners jointly build a "new vision"
- 数据库操作 Day 6
- JD cloud golden autumn cloud special offer is in progress! Code scanning participation activities
- Custom QML control: imagebutton
- 200 多家 ISV 入驻!阿里云计算巢发布一周年
- 指针
- 分配内存:malloc()和free()
- OCCT学习003-----MFC单文档工程
- Vs code的安装步骤及环境配置
猜你喜欢
Live broadcast preview | how to improve enterprise immunity through "intelligent edge security"?
【C语言系列】—深度解剖数据在内存中的存储(二)-浮点型
阿里云架构师细说游戏行业九大趋势
The road to success in R & D efficiency of 1000 person Internet companies
365天挑战LeetCode1000题——Day 042 数组序号转换 + 相对名次 离散化处理
QtCreator+CMake编译器设置
200 多家 ISV 入驻!阿里云计算巢发布一周年
R & D efficiency | analysis of kubernetes' core technology and Devops' landing experience
来!看排名一年上升16位的ClickHouse,如何在京东落地实践
【C语言系列】— 一道递归小题目
随机推荐
365天挑战LeetCode1000题——Day 042 数组序号转换 + 相对名次 离散化处理
Solution: find the position of the first and last element in a sorted array (personal notes)
Live broadcast Preview: integration of JD cloud Devops and jfrog product library
平行云CEO 李岩:CloudXR ,开启通往元宇宙的通道
为啥谷歌的内部工具不适合你?
osg进阶-序
Occt learning 003 - MFC single document project
EXIT中断详解
QML type: mousearea
文件结尾
【C语言系列】— 一道递归小题目
With cloud simulation platform, Shichuang technology supports the upgrading of "China smart manufacturing"
CryEngine5 Shader调试
JD cloud and Forrester consulting released a hybrid cloud report that cloud Nativity has become a new engine driving industrial development
Thousands of databases, physical machines all over the country, JD logistics full volume cloud live record | interview with excellent technical team
Occt learning 001 - Introduction
167. 两数之和 II - 输入有序数组
How rimworld uploads creative workshops through steamcmd
JD cloud golden autumn cloud special offer is in progress! Code scanning participation activities
Why is Google's internal tools not suitable for you?