1,在开发项目时,若发现你请求的数据不报错,但就是请求不到数据的时候,那么此时可能是后端打断点了。让后端去除断点即可。
2,在一些数据固定的时候,为了不改变前端的布局,那么就需要后端对数据进行编写固定,若后面添加数据时,后端只需要改变某一块内容即可,不涉及到前端的内容,这个过程称之为 “字典”。
3,在小程序中,进行项目请求数据,且做必填项时,可以这样去做:
apply() {
var that = this;
if (that.idcardName == "") {
uni.showToast({
title: "请填写姓名",
icon: 'error'
})
return;
}
let regs =
/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)/;
if (!that.idcardNo) {
uni.showToast({
title: '请填写身份证号',
icon: 'none'
})
return
} else if (!regs.test(that.idcardNo)) {
uni.showToast({
title: '身份证号码不正确',
icon: 'none'