uniapp
- 创建项目
- 跳转页面
- 设置tab页
- 发送请求
创建项目
使用HBuilder X 点击项目
跳转页面
uni.navigateTo({
url: '../one/one?id=1&name=uniapp'
});
设置tab页
pages.json中设置
"tabBar": {
"color": "#7A7E83",
"selectedColor": "red",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/528722.jpg",
"selectedIconPath": "static/671262.jpg",
"text": "首页"
}, {
"pagePath": "pages/one/one",
"iconPath": "static/35226.jpg",
"selectedIconPath": "static/671262.jpg",
"text": "分类"
}]
},
发送请求
uni.request({
url: 'xxxx', //仅为示例,并非真实接口地址。
method:"POST",
data: {
username: "admin",
password: "xxx",
},
success: (res) => {
console.log(res);
}
});
同Vue的特性差不多,直接可以调用data的东西,调用api和微信小程序差不多,将wx换成uni