代码拉取完成,页面将自动刷新
这个插件一共有以下几个方法
{
push 正常导航到下一个页面
replace 关闭当前页面进入下一个页面
closeAndTo 关闭所有页面进入下一个页面
switchTab 导航到tabs上的页面
back 返回上一个或者几个页面
preload 预加载页面
}
你可以这么调用它,至于为啥要封装,是因为习惯了Vue的那种导航方式简洁方便。
你可以这么来使用他
this.$routers.push(url,query);
this.$routers.replace(url,query);
this.$routers.closeAndTo(url,query);
this.$routers.switchTab(url,query);
this.$routers.back(delta);
this.$routers.preload(url,query);
$formatTime -> 格式话日期(封装好以后才发现这玩意uview里面有了)
$createGuid -> guid 和uview里面不同
$chooseImages -> 选择图片 是一个异步方法
$previewImages -> 预览图片 也是一个异步方法
直接使用
console.log(this.$formatTime(date))
定义api接口
const init = (params = {}) => vm.$u.get('/api/common/init',params);
使用
this.$api.init().then(res => {
console.log(res);
})
这个是uview里面的ajax请求框架的封装,主要是拦截器好评~~~
消息推送这个功能还有一些需要去做的 你可能需要去看看 Dcloud push
使用:
import MessagePush from '@/common/message.push.js';
// #ifdef APP-PLUS
this.push = new MessagePush();
const client = this.push.getClientInfo();
console.log(client)
this.push.createMessage('测试消息推送','测试消息推送','/static/Nr304OPr3m.png');
this.push.clickMessage(res => {
console.log(res);
uni.showModal({
content:JSON.stringify(res)
})
});
// #endif
// #ifdef H5
this.show = true;
// #endif
this.$scanQrCode()
.then(res => {
})
.catch(err => {
});
<redPacket :visible="visible" @close="close" money="30"></redPacket>
data:()=>({
visible:false
})
methods:{
openRedPacket() {
this.visible = true;
},
close() {
this.visible = false;
},
}
在components目录下面
FilterNullToEmpty - null转空字符串
FilterAmountFormat - 金额格式化显示
FilterDateTimeFormat - 日期格式化显示
FilterMoneyFormat - 数字格式化显示
FilterTextMaxLength - 字符串过长截断
FilterWanFormat - 数字格式化显示,单位为万
FilterIdCard - 身份证隐藏
使用
<view>
<text>申请日期:{{
propsInfo.createTime
| FilterDateTimeFormat("YYYY年MM月DD日 HH时mm分")
}}</text>
</view>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。