当前位置:网站首页>小程序中的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&
边栏推荐
猜你喜欢

直播预告|如何节省30%人工成本,缩短80%商标办理周期?

365天挑战LeetCode1000题——Day 035 每日一题 + 二分查找 13

QML type: mousearea

阿里云架构师细说游戏行业九大趋势

R & D efficiency | analysis of kubernetes' core technology and Devops' landing experience

Li Yan, CEO of parallel cloud: cloudxr, opens the channel to the metauniverse

Alibaba cloud architect Liang Xu: MES on cloud box helps customers quickly build digital factories

More than 200 ISVs have settled in! The first anniversary of Alibaba cloud computing nest

321, Jingdong Yanxi × Nlpcc 2022 challenge starts!

NVIDIA Zhou Xijian: the last mile from design to digital marketing
随机推荐
Cryengine3 debugging shader method
Cmu15-213 malloc lab experiment record
Xiaolu Inn - Trailer
OCCT学习003-----MFC单文档工程
365天挑战LeetCode1000题——Day 035 每日一题 + 二分查找 13
C语言数组入门到精通(数组精讲)
JD cloud and Forrester consulting released a hybrid cloud report that cloud Nativity has become a new engine driving industrial development
如视技术副总裁杨永林:当传统产业遇到“数字空间”
C语言数组典型应用代码详细讲解—高手误入(逐步代码详解)
终端shell常用命令
·来一篇编程之路的自我介绍吧·
CryEngine5 Shader调试
Occt learning 001 - Introduction
321, Jingdong Yanxi × Nlpcc 2022 challenge starts!
OCCT学习002-----环境搭建
时间复杂度和空间复杂度
数组学习之入门简单题 两数之和
Alibaba cloud Zhang Xintao: heterogeneous computing provides surging power for the digital economy
APP常用跨端技术栈深入分析
数千个数据库、遍布全国的物理机,京东物流全量上云实录 | 卓越技术团队访谈录