工作中遇到的一些问题及解决方法(vue)
程序员文章站
2022-06-04 14:34:31
...
1.到账时间:到账时间执行T+1至T+3政策,遇周末顺延
isFriday () {
let nowDay = new Date()
let whichWeekday = nowDay.getDay()
switch (whichWeekday) {
case 0:
case 1:
this.todayAccount = nowDay.getTime() + 24 * 60 * 60 * 1000
this.toAccount = nowDay.getTime() + 24 * 60 * 60 * 1000 * 3
break
case 2:
this.todayAccount = nowDay.getTime() + 24 * 60 * 60 * 1000
this.toAccount = nowDay.getTime() + 24 * 60 * 60 * 1000 * 5
break
case 3:
this.todayAccount = nowDay.getTime() + 24 * 60 * 60 * 1000
this.toAccount = nowDay.getTime() + 24 * 60 * 60 * 1000 * 4
break
case 4:
this.todayAccount = nowDay.getTime() + 24 * 60 * 60 * 1000 * 1
this.toAccount = nowDay.getTime() + 24 * 60 * 60 * 1000 * 5
break
case 5:
this.todayAccount = nowDay.getTime() + 24 * 60 * 60 * 1000 * 3
this.toAccount = nowDay.getTime() + 24 * 60 * 60 * 1000 * 5
break
case 6:
this.todayAccount = nowDay.getTime() + 24 * 60 * 60 * 1000
this.toAccount = nowDay.getTime() + 24 * 60 * 60 * 1000 * 4
break
}
}
在created中调用isFriday()函数,生命周期,vue实例被生成后调用函数
2.开户银行(20字以内显示全名,超出20字,显示前8后8中间使用省略号用“......”连接)
<span>{{hashName | ellipsis}}</span>
filters: {
ellipsis (value) {
if (!value) return ''
if (value.length > 10) {
let all=value.length;
alert(all)
let ceshi = all-8
let hou = str.substring(ceshi,all);
let fisrt = str.substring(0,8);
if (all > 20) {
$(".jianjie").text(fisrt+"…"+hou);
}
//return value.slice(0,20) + '...'
}
return value
}
}
3.路由导航守卫(用于后台管理系统登录前的一个判断,跳转路由验证用户登录状态)
router,beforeEach((to,from,next) =>{})
router.beforeEach((to, from, next) => {
// console.log(to.path)
if (to.path !== '/login' && to.path !== '/regist') {
if (localStorage.getItem('sessionId')) {
next()
} else {
next({path: '/login'})
}
} else {
next()
}
})
to为向后走的路由对象,包括路由的完整信息(router即将进入的路由对象)
from为从哪跳来的路由对象(当前导航即将离开的路由)
next()控制路由向下走,重新定义路由跳转的路由next(‘路由路径) (进行管道中的一个钩子,如果执行完了,则导航的状态就是 confirmed (确认的);否则为false,终止导航。)
上一篇: git遇到的错误集锦及解决方法
下一篇: 提高NetBeans的代码提示速度
推荐阅读
-
Mysql数据库从5.6.28版本升到8.0.11版本部署项目时遇到的问题及解决方法
-
ubuntu14.04 使用中遇到的问题及解决方法集锦
-
Vue动态加载图片在跨域时无法显示的问题及解决方法
-
Vue2.0使用axios引入本地JSON文件时遇到的问题及解决
-
phpStudy配置多站点多域名方法及遇到的403错误解决方法
-
详解vue-cli 快速搭建单页应用之遇到的问题及解决办法
-
后台使用freeMarker和前端使用vue的方法及遇到的问题
-
VUE预渲染及遇到的坑
-
framework7的改进,以及与vue组合使用遇到的问题以及解决方法 (附vue的原理)
-
Win10系统安装MySQL8.0.13遇到的问题及解决方法