[TOC]
>### 1.基本語法
~~~
div view
p text
img image
button button
~~~
>### 2.發送ajax
~~~
onLoad(){
wx.showLoading({
title:"正在加載數據"
});
var url="http://result.eolinker.com/cR71r8Me1911deea5ab4b01704bbfe0b97948d26eb2d31d?uri=/classic/latest";
wx.request({
url,
header: {
'Content-Type':'application/json'
}, // 設置請求的 header
success: (res)=>{
console.log(res.data);
this.setData({
msg:res.data.title
})
wx.hideLoading();
}
})
}
~~~
>### 3.插值表達式
index.js
~~~
Page({
data: {
msg:"hello world",
},
~~~
index.wxml
~~~
<view>{{msg}}</view>
~~~