当前位置:网站首页>WXML模板语法、WXSS模板样式、全局配置、页面配置和网络数据请求
WXML模板语法、WXSS模板样式、全局配置、页面配置和网络数据请求
2022-06-21 16:49:00 【Blizzard前端】
WXML模板语法
数据绑定
1.数据绑定的基本原则
①在data中定义数据
②在WXML中使用数据
2.在data中定义页面的数据

3.Mustache语法格式

4.Mustache语法的应用场景
Mustache语法的主要应用场景如下:
①绑定内容
②绑定属性
③运算(三元运算、算数运算)
5.动态绑定内容

6.动态绑定属性

7.三元运算

8.算数运算

事件绑定
1.什么是事件

2.小程序中常用的事件

3.事件对象的属性列表
当事件回调触发的时候,会收到一个事件对象event,它的详细属性如下表:
4.target和currentTarget的区别
一般只会用到target
5.bindtap的语法格式
定义的函数与data同级

6.在事件处理函数中为data中的数据赋值

7.事件传参

"{ {2}}"传递的是数字2,“2”传递的是文本字符串

都是固定写法,唯一可改的是参数名
8.bindinput的语法格式

9.实现文本框和data之间的数据同步(双向绑定)
实现步骤:
①定义数据
②渲染结构
③美化样式
④绑定input事件处理函数
value="{ {}}"设置文本框初始值


条件渲染
1.wx:if

2.结合block标签使用wx:if

3.hidden

4.wx:if与hidden的对比

列表渲染
1.wx:for
默认情况下,当前循环项的索引用index表示;当前循环项用item表示

2.手动指定索引和当前变量名
默认情况下,当前循环项的索引用index表示;当前循环项用item表示

3.wx:key的使用
建议使用wx:for的时候都加一个key值
建议使用wx:for的时候都加一个key值
WXSS模板样式
边栏推荐
- 【蓝桥杯省赛真题35】Scratch水面倒影 少儿编程scratch编程蓝桥杯省赛真题讲解
- EtherCAT object dictionary analysis
- 透过华为军团看科技之变(四):互动媒体(音乐)
- postman关联,完成接口自动化测试
- Gartner 网络研讨会 “九问数字化转型” 会后感
- POSIX create terminate thread
- 数字藏品系统开发,NFT艺术品交易平台搭建
- 加密大崩盘,Web3游戏到底还有没有未来?5篇论文深度探讨
- 编写第一个C#应用程序——Hello, C#
- Live broadcast platform development, live broadcast of each category and single example design display
猜你喜欢

天天在都在谈的S3协议到底是什么?一文带你了解S3背后的故事

Server socket program

Stack cognition -- basic use of reverse IDA tools

Encryption crash, is there a future for Web3 games? In depth discussion of 5 papers

Class, interface, function

AI自己写代码让智能体进化!OpenAI的大模型有“人类思想”那味了

基本文件操作

论文笔记 ACL 2022|Unified Structure Generation for Universal Information Extraction

编写第一个C#应用程序——Hello, C#

科普大佬说 | 如何打造自己的AI创造力?
随机推荐
Not graduated from a first-class university, but passed the self-study software test and entered the initial 22K annual salary of Alibaba
加密大崩盘,Web3游戏到底还有没有未来?5篇论文深度探讨
智慧三农数字王宁:适合初学者的前5日交易秘诀
From demand to open source, how to look at it with new eyes?
Seventy years of neural network: review and Prospect
Runmeide Healthcare a réussi l'audience d'inscription sur la liste: les pertes devraient augmenter, Huo Yunfei Brothers détenant environ 33%
研发仅占3%的蕉下,是防晒黑科技,还是夏天的智商税?
怎么安装 Laravel
泰克示波器TCP202电流探头的使用说明
如何把1000随机分配成10个数
List set to comma concatenated string
Live broadcast platform development, live broadcast of each category and single example design display
Lua导出为外部链接库并使用
EtherCAT igh 'Fatal Sync Error'——0x002C,0x001A
EtherCAT igh function attempt
SCAU Software Engineering Fundamentals
Compose programming idea
AttributeError: ‘Book‘ object has no attribute ‘sheet‘
结构建模设计——Solidworks软件之特征成型中旋转切除与圆角倒角功能实战总结(绘制一个沉头螺丝孔)
The source code of the online live broadcast system enables you to request the list interface and touch the bottom page to load