当前位置:网站首页>列表渲染的三种方式
列表渲染的三种方式
2022-04-22 05:45:00 【礼礼。】

根据元素 和元素的索引名 就可进行列表渲染
for="{
{list}}":list为源数据数组,默认的数组元素名为$item
for="{
{value in list}}":value为自定义的数组元素名,默认的数组元素索引名为$idx
for="{
{(index, value) in list}}":index为自定义的数组元素索引名,value为自定义的数组元素名
<import name="tabbarpage" src="../Tabbar/index.ux"></import>
<template>
<div class="tutorial-page">
<!-- 方式1:默认$item代表数组中的元素, $idx代表数组中的索引 -->
<div class="tutorial-row" for="{
{list}}" tid="uniqueId">
<text>{
{
$idx}}.{
{
$item.name}}</text>
</div>
<!-- 方式2:自定义元素变量名称 -->
<div class="tutorial-row" for="value in list" tid="uniqueId">
<text>{
{
$idx}}.{
{
value.name}}</text>
</div>
<!-- 方式3:自定义元素、索引的变量名称 -->
<div class="tutorial-row" for="(personIndex, personItem) in list" tid="uniqueId">
<text>{
{
personIndex}}.{
{
personItem.name}}</text>
</div>
<tabbarpage></tabbarpage>
</div>
</template>
<script>
export default {
private: {
list: [
{
name: 'aa2', uniqueId: 1},
{
name: 'bb', uniqueId: 2},
{
name: 'cc', uniqueId: 3}
]
},
}
</script>
<style lang="less">
.tutorial-page {
flex-direction: column;
background-color: #ccc;
}
</style>
版权声明
本文为[礼礼。]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45736311/article/details/124019079
边栏推荐
- x86汇编语法:AT&T和Intel
- js等待异步执行完成后在执行
- Oracle uses C language to write custom functions
- stm32 printf 重定向 虚拟示波器
- File write data to local
- 单、多通道图像反差处理
- 常见面试问题 - 3(操作系统)
- Photoresist for learning of Blue Bridge Cup embedded expansion board
- STM32 learning note 2 - set GPIO register to realize running water lamp
- 写一个函数的声明,使其返回数组的引用并且该数组包含10个string对象(笔记)
猜你喜欢

STM32 study notes 4 - HC_ Commissioning record of SR04 ultrasonic ranging module

Blue Bridge Cup embedded expansion board learning nixie tube

Geojson file and ShapeFile file single conversion gadget

jeecgboot-online在线开发2

DS18B20 of Blue Bridge Cup embedded expansion board learning

Part 85 leetcode sword refers to offer dynamic programming (II) frog jumping steps

Chapter 89 leetcode refers to offer dynamic programming (6) translating numbers into strings

Blue Bridge Cup embedded expansion board learning DHT11

LeetCode: 322. 零钱兑换(动态规划,递归,备忘录递归以及回溯)

Jeecgboot online development 3
随机推荐
VB operation, Excel format setting and printing page setting (Simplified)
File write data to local
Experience of constructing H-bridge with MOS tube
MODBUS协议简记
两指针相加?(合法or不合法)
IWDG
Error in QT: undefined reference to ` widget:: settime()‘
Analysis of Modbus Protocol in TCP communication
c#委托、线程、定时器学习感悟
Markdown 语法支持测试
Code color difference of QT learning
Invalid transform origin base point setting
自动获取指定路径文件夹,删除文件夹及子文件
判断完全二叉树
Compiling OpenSSL on HP UNIX and using
TXT text content is deleted one by one
50道SQL练习题及答案与详细分析
On the relationship between the Euler angle of RT matrix and the type of pose in Halcon in hand eye calibration
IFIX question summary Q & A (personal record)
指针所指的地址值及指针所指对象的值(学习笔记)