需要一个keyID

语法(类似vue语法)

数据渲染{{}}

<view wx: for="{{arr}}" wx:key='index'>{{iindex}}======{{item}}</view>

flage=true

<view wx:if='{{flage}}'> 0</view>

<view>{{flage?'123':'123456'}}</view>

<view wx:else>1</view>

<view wx:if='{{num==222}}'>222</view>

<view wx:if="{{num==333}}">333</view>

<view wx:else>其他</view>

<view wx:for="qwkjdnskdnas"  wx:key='index' >{{item}}<view>

修改循环中item为demo 

<view wx:for='{{arr}}' wx:for-item='demo'>{{demo}}</view>

代码块不会显示结构

<block wx:for='{{['a','b','c']}}'>

<text>{{item}}</text>

</bock>

事件绑定 (可以传递参数)

<view bindtap='tab' data-a='asdasd'   data-b='asdasd'>绑定事件</view>

bindtap事件有冒泡 catchtap不会

<view bindtap='tab1'>tap爷爷

<view catchtap='tab2'>爸爸

<view catchtap='ta3'>松子</view>

</view>

</view>

bindblur 失去焦点触发

<input  type='text'  bindblur='bur' />

navigator组件

<navigator url='pages/index/index' open-type="navigate'>navigate跳转 跳转到指定页面,不能跳转到tabbar 页面</navigator>

<navigator url='pages/index/index' open-type='redireact'> redirect 跳转,关闭当前页面,跳转到应用内的某个页面,但允许跳转到tabbar页面</navigator>

<navigator url='pages/01study/01study' open-type='switchTab'>switchTab 跳转,跳转到tabBar页面关闭所有其他所有非tabBar 页面</navigator>

<navigator url='pages/index/index' open-type='reLauch'  > reLanuch跳转,关闭所有页面,跳转到指定页面</navigator>

<navigator target='minProgram' open-type='exit'>退出小程序</navigator>

<navigator target='minProgram' app-id='asdsadasd4544'>跳转带欢乐斗地主</navigator>

<navigator target='minProgram'>触发移除事件</navigator>

<button bindtap='linTo>跳转</button>

自定义组件<my-com num='{{num}}'></my-com>