微信小程序-跳转-本地获取存储-手机号验证

获取本地存储

1
2
3
4
5
//获取本地存储
wx.getStorageSync("SysInfo").permission.title;

//设置本地存储
wx.setStorageSync("UserID", data.data.user_id);

跳转

1
2
3
4
5
//直接跳转并不删除当前页面
wx.navigateTo({'url':'/pages/shop/c/register/register'});

//删除当前页面并跳转
wx.redirectTo({'url':'/pages/shop/c/register/register'});

手机号验证

1
2
3
4
const phoneVerification = function(phone) {
let reg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;
return reg.test(phone);
}