
uniapp 小功能 提示功能 路由跳转 手机正则 获取平台信息以下代码写在 App.vue 文件当中提示功能/** - 成功错误提示 - param {Object} that - param {Object} text - param {Object} timer */errorTip:function(that,text,timer){uni.showToast({title:text,icon:none,duration:timer})},方法调用constappgetApp();app.errorTip(this,提示内容,2000);路由跳转/** - 路由跳转 - param {Object} url */goto:function(url){uni.navigateTo({url:url,fail:(){uni.switchTab({url:url,})}})},方法调用constappgetApp();goto(e){leturle.currentTarget.dataset.url;letide.currentTarget.dataset.id;leturlidurl?idid;app.goto(urlid);},校验手机格式/** - 校验手机格式 - param {Object} mobile */checkMobile:function(mobile){returnRegExp(/^1[3456789]\d{9}$/).test(mobile);},方法调用constappgetApp();app.checkMobile(手机号码);获取详细平台信息/** * 获取详细平台信息 */getPlatfrom:function(){letPlatfromundefined;// #ifdef H5PlatfromH5;// #endif// #ifdef MP-WEIXINPlatfromMP-WEIXIN;// #endif// #ifdef APP-PLUSPlatfromAPP-PLUS;// #endifreturnPlatfrom;},方法调用constappgetApp();app.getPlatfrom();