一、事件绑定
bindtap
<button class="weui-btn" type="default" bindtap="openConfirm">Confirm Dialog</button>
<button class="weui-btn" type="default" bindtap="openAlert">Alert Dialog</button>
二、样式导入
@import
@import 'style/weui.wxss';
三、列表渲染
wx:for
Page({
items: [{
message: 'foo',
},{
message: 'bar'
}]
})
<view wx:for="{{items}}" wx:for-index="index" wx:for-item="item">
{{index}}: {{item.message}}
</view>
block wx:for
<block wx:for="{{[1, 2, 3]}}">
<view> {{index}}: </view>
<view> {{item}} </view>
</block>
四、模块化
定义:
function sayHello() {
console.log("hello");
}
module.exports = {
sayHello:sayHello
}
引用:
const common = require("../../utils/common.js");
function say() {
common.sayHello();
}
五、8大组件
-
视图容器
-
基础内容
-
表单组件
-
操作反馈
-
导航
-
媒体组件
-
地图
-
画布
六、三个文件
-
app.js
-
app.json
-
app.wxss
|