当前位置:网站首页>【小程序的 插值表达式,渲染判断,绑定事件以及分享】
【小程序的 插值表达式,渲染判断,绑定事件以及分享】
2022-07-22 23:02:00 【香饽饽慧】
文章目录
- 前言
- 一、小程序的插值语法?
- 二、小程序的判断,条件渲染
- 三、小程序的绑定事件
- 四 、小程序的分享
前言
提示:这里可以添加本文要记录的大概内容:
小程序的 插值语法 ,条件渲染,小程序的绑定事件 和小程序的分享功能
提示:以下是本篇文章正文内容,下面案例可供参考
一、小程序的插值语法?
1.用 { { 内容 }} 在页面表示 ,里面可以插入 基本数据类型,复杂数据类型和表达式
1)基本数据类型
string , number ,null , boolean ,undefined
2)引入数据类型(复杂类型)
对象 object 数组 array
3)表达式
1)三元表达式 值 ?"为true" : "为false"
2)算术表达式 ++ += -- -=
3)逻辑表达式 < <= = > =>
2.{ {变量}} 在.js文件的data中定义变量的值
3.获取data的数据
this.data.属性名
4.改变data的数据
this.setdata({
属性名:改变后的值
})
二、小程序的的条件判断
语法 : wx : if
1)wx:if = "值" //值为true--显示 false 隐藏
是动态的向dom中添加或者删除标签控制显示隐藏
2)hidden 隐藏
hidden ="值" //值为true--隐藏 false 显示
是通过css中display控制的显示隐藏
三、小程序的绑定事件
1.通过 bind事件=‘事件’
2.在.js文件中和data同一级 定义事件名
事件名(){}
3.获取data的数据
this.data.属性名
4.改变data的数据
this.setdata({
属性名:改变后的值
})
5.跟随事件传参数
data-属性名=‘传递的值’
事件名(e){
e.currentTarger.dataset.属性名
e.targer.dataset.属性名
}
四、小程序的分享
两种办法:
1. 右上角胶囊 的 。。。
2. button open-type="share" <button open-type="share">分享</button>
边栏推荐
猜你喜欢

Has the live broadcast function of the multi merchant system been used? 666 for used friends!

Understand the interrupt system in STM32 in simple terms -- from principle to simple engineering examples -- nanny level tutorial

c语言十进制数转二进制数

自从我使用HiFlow场景连接器后,在也不用担心成为“落汤鸡”了

Networkx visualizes graphs

RPC-BDY(5)-服务自动注销、负载均衡

Redis中的数据类型

论文阅读:The Perfect Match: 3D Point Cloud Matching with Smoothed Densities

Promise (I)

Initializing, cleaning up and const decorating member functions of constructors
随机推荐
oh-my-zsh
promise(一)
Flick enables mapstate to implement keyedstate
Go concurrent programming basics: what is context
C language decimal number to binary number
容器监控三剑客CAdvisor收集监控数据 + InfluxDB储存数据 + Granfana展示图表数据的简介
Shell变量、系统预定义变量$HOME、$PWD、$SHELL、$USER、自定义变量、特殊变量$n、$#、$*、[email protected]、$?、env看所有的全局变量值、set看所有变量
flink使MapState实现KeyedState
Redis 配置文件
云计算或成时代新拐点?从哪些点可以看出?
This is not a true sense of the meta universe, which should have its own distinctive characteristics and unique development logic
Let's talk about the charm of code language
BufferedInputStream缓冲区填充问题
odbc excel--2022-07-21
自从我使用HiFlow场景连接器后,在也不用担心成为“落汤鸡”了
原生js实现dom的获取及操作
Data types in redis
mysql使用sql语句查询某个字段值除10等于0的所有数据
Has the live broadcast function of the multi merchant system been used? 666 for used friends!
【JS 逆向百例】某公共资源交易网,公告 URL 参数逆向分析