一、配置路由
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
}
}, {
"path": "pages/home/home",
"style": {
"navigationBarTitleText": "登录",
"enablePullDownRefresh": false
}
}
],
二、底部导航
"tabBar": {
"list": [{
"pagePath": "pages/home/home",
"text": "首页",
"iconPath": "static/img/home.png",
"selectedIconPath": "static/img/home_active.png"
}, {
"pagePath": "pages/index/index",
"text": "列表",
"iconPath": "static/img/label.png",
"selectedIconPath": "static/img/label_active.png"
}]
},
三、提示框
uni.showToast({ //提示框
title: '失败,请输入正确手机号',
icon: 'none',
duration: 2000
});
uni.showToast({ //成功提示框
title: '注册成功',
icon: 'success',
duration: 2000
})
//确认取消框
uni.showModal({
title: '提示',
content: '确定要退出登录吗?',
success: (res) => {
if (res.confirm) { //用户点击确定按钮
uni.removeStorageSync('data')
uni.navigateTo({
url: '/pages/home/home'
})
} else if (res.cancel) { //用户点击取消按钮
uni.showToast({ //成功提示框
title: '取消退出',
icon: 'none',
duration: 2000
})
}
}
});
//拨打手机号
uni.makePhoneCall({
phoneNumber: e
})
4.本地存储的使用
uni.setStorageSync('data', JSON.stringify(res.data.data)) //设置
uni.getStorageSync('data') //获取
uni.removeStorageSync('data') //删除