当前位置:网站首页>微信小程序详解wx:if elif else的用法(搭配view、block)
微信小程序详解wx:if elif else的用法(搭配view、block)
2022-07-21 18:05:00 【CodingForAndroid】
1、搭配view 控制显示
<view wx:if="{
{boolean==true}}">
<view class="bg_black"></view>
</view>
<view wx:elif="{
{boolean==false}}">
<view class="bg_red"></view>
</view>
<view wx:else>
<view class="bg_red"></view>
</view>
2、搭配block 控制显示
<block wx:if="{
{boolean==true}}">
<view class="bg_black"></view>
</block>
<block wx:elif="{
{boolean==false}}">
<view class="bg_red"></view>
</block>
<block wx:else>
<view class="bg_red"></view>
</block>
小程序 wx:if多条件
<view wx:if="{
{a}}">单个条件</view>
<view wx:if="{
{a || b || c}}">多个或条件</view>
<view wx:if="{
{a && b && c}}">多个且条件</view>
wx:if else 的判断
<view wx:if="{
{a > 5}}">6</view>
<view wx:elif="{
{a < 5}}">4</view>
<view wx:else>5</view>
注意:wx:if不仅仅是view标签可以用,其他的标签里也可以用
谢谢认真观读本文的每一位小伙伴,衷心欢迎小伙伴给我指出文中的错误,也欢迎小伙伴与我交流学习。
欢迎爱学习的小伙伴加群一起进步:[点击链接加入群聊【编程之美】
边栏推荐
- 让盒子居中且距离浏览器左右各100px做动画
- Vector Foundation
- Memory allocation of server instance in EAS cluster environment
- Mvcc multi version concurrency control for MySQL learning
- Small game cases of aircraft dodging bullets
- Gluttonous snake
- EAS BOS开发环境客户端启不起来,但是服务端确显示准备就绪
- How much do you know about the benefits of encouraging enterprise knowledge sharing?
- Mathematical operation
- Thunderbolt interview questions
猜你喜欢
Bitmap of redis principle
数组的复制和数组地址值的复制
高频leetcode深搜部分:剑指 Offer 36. 二叉搜索树与双向链表
Modify the hosts file to customize the local IP domain name
The multi indicator data of 4000+ listed companies' provinces, cities and operations have been updated to 2022.1
Luoyang comprehensive bonded zone was officially approved by the State Council to be established
flex布局的常用属性
嵌入式之网络问题总结(网卡丢包、网卡无法识别)
Gluttonous snake
高频leetcode深搜部分:124. 二叉树中的最大路径和
随机推荐
关于线程 thread (1)概念简介
加速企业数据应用创新的核心能力——灵活性
Tens of millions of data: from 2000 to 2019, enterprise registration data longitude and latitude, registration number and other multi indicator information of provinces, cities and counties in China
win10 以微软账户登录 默认打开所有程序以管理员权限打开:2020-12-14
粘性定位(sticky)详解
EAS 审批流相关表
FAQ during using Harry (question answering)
Review background management system practice: two packaging styles of request parameters
修改Hosts文件自定义本机IP域名
程序员那些年的斗智斗勇!!!
EAS 登录界面修改
EAS BOS 报表开发
排序方法:冒泡排序(使用数组实现一串数字的顺序排列(从大到小或从小到大))
贪吃蛇
嵌入式之认识网卡phy自协商
Gluttonous snake
EAS Web BIM启动访问提示500错误
Bitmap of redis principle
uni拦截器
Configuration de l'installation mysql - version 8.0 - Windows