1.下载开发环境
https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html
2.开发环境介绍
3.组件:
<view>hello</view>
<text selectable>hello</text> =<div> p 是否可选择
<text decode>hello hello</text> =<span> 转义字符
<button type="primary">click</button> 4种样式,form-type submit,reset ;opent-type 3种使用方法:getUserInfo,getPhone,contact
<checkbox-group>
<checkbox value="1">boy</checkbox>
<checkbox value="2">girl</checkbox>
</checkbox-group>
<radio-group>
<radio>boy</radio>
<radio>girl</radio>
</radio-group>
<block>hello</block> 代码块不会被渲染,里面的标签会渲染
<block>
<view>hello</view>
<text selectable>hello</text>
</block>
<input type="text" value="hello"></input>
<input type="password"></input>
<input type="number"></input>
<input placeholder="hello" placeholder-style="color:red" placeholder-class="style1" disabled maxlength="10"></input>
绑定事件 bindinput="changeme"
传参数data-test2="1" envent.currentTarget.dataset
this.setData(
{
msg:"update msg"
}
)
获取用户信息,获取电话号码,联系客服
富文本标签,msg="html"
<rich-text nodes="{{msg}}"></rich-text>
弹窗:
wx.showToast(
{
title:‘jiazaizhong‘,
icon:‘loading‘, //success,none
duration:2000
}
)
wx.showLoading()
xw.hideLoading();
wx.showModal()
{
title:‘tishi‘,
content:‘tangchuang‘,
success(res){
if(res.confirm==true)
{
确定
}
else{
取消
}
}
}
页面跳转:
标签跳转:<navigator url="/pages/test/test">goto</navigator>
事件跳转:wx.navigateTo(
{
url:‘/page/test/test?id=1‘,
}
)
获取后端数据:
getdatat(){
var that=this;
wx.request(
url:‘http://localhost:1028/jobs‘,
success(res)
{
var data=res.data;
that.setData(
{
jobs:data
}
)
}
)
}
demo:view,text,video,block,class,api