小程序1:判断标签、循环标签、事件类别、事件绑定方式

<include src="../templates/header/header"/> 


<button type="default"  bindtap="btnClick" >{{btnName}} </button>

<text class="row">{{text}}</text>

<text>判断标签:</text>

<text  class="row" wx:if="{{true}}">条件判断:true显示</text>
<text  class="row" wx:if="{{false}}">条件判断:false隐藏</text>

<text  class="row" wx:if="{{show}}">js条件绑定:true显示,false隐藏</text>

<text  class="row" wx:if="{{isShow}}">js点击事件控制:显示隐藏</text>


<!-- 判断标签: 如果为真,显示按钮1;如果为假,显示按钮2 -->

<text  class="row" wx:if="{{show}}">{{name}} 1 </text>
<text  class="row" wx:else>{{name}} 2 </text>


<!-- 循环标签 -->
<text>循环标签:</text>

<view  class="box">
  <view wx:for="{{news}}">{{item}}</view>
</view>

<view  class="box">
  <view wx:for="{{news}}" wx:for-item="itemx">
    {{index+1}}-{{itemx}}
  </view>
</view>


<!-- 事件类别 -->
<text>事件类型:</text>
<view  class="box">
    <text class="p">点击事件:tap</text>
    <text class="p">长按事件:longtap</text>
    <text class="p">触摸事件:touchstart touchend touchmove touchcancel</text>
    <text class="p">其他:submit input</text>
</view>



<!-- 事件绑定-->
<text>事件绑定方式:</text>
<view  class="box">
    <text class="p">bind绑定:触发冒泡事件</text>
    <text class="p">catch绑定:阻止冒泡事件</text>
</view>


<!-- 事件的对象-->
<text>事件的对象:</text>
<view  class="box">
    <text class="p">事件类型:type</text>
    <text class="p">时间戳:timeStamp</text>
    <text class="p">事件源组件:target</text>
    <text class="p">当前组件:currentTarget</text>
    <text class="p">触摸点数:touches</text>
</view>



<!-- 循环标签 -->
<text>模板:两种导入方式</text>

<import src="../templates/footer/footer"/>  
<template is="footer1" data="{{text:'我是页脚的动态数据'}}"/> 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值