上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: // 后台返回菜单json数据,根据组件缺少key 与title,需对数据进行二次加工。 // 菜单结构树转换 export const changeMenuTreeData = (arr) => { if (arr) { arr.forEach((item, index) => { // item 阅读全文
posted @ 2020-04-28 14:43 Gaochunling 阅读(560) 评论(0) 推荐(0) 编辑
摘要: 主路由文件,核心函数是 webpack 的 api —— require.context() ,通过执行此函数获取一个特定的上下文,主要用来实现自动化导入模块。项目中各个业务的路由可以充分解耦,路由文件后缀名为 xxx.routers.js 即可,主路由文件会自动化导入新增的各业务路由文件。 阅读全文
posted @ 2020-04-14 11:04 Gaochunling 阅读(431) 评论(1) 推荐(0) 编辑
摘要: 问题描述:ios移动端输入内容,软键盘弹出,页面内容整体上移。但是键盘收起,页面内容不下滑。导致定位不正确,事件无法被触发; 解决方案:给点击事件控制滚动条 阅读全文
posted @ 2019-11-06 09:39 Gaochunling 阅读(1217) 评论(0) 推荐(0) 编辑
摘要: /** * xml工具 * xml对象和String字符串之间的转换 * ///convert string to xml object (将字符串转换成xml对象) function string2XML(xmlString) { //所有浏览器统一用这种方式处理(因为高版本的浏览器都支持) let parser = new DOMParser(); let xmlObject = parser 阅读全文
posted @ 2019-10-10 14:51 Gaochunling 阅读(4912) 评论(0) 推荐(0) 编辑
摘要: 如下图所示,项目在IE11下打开报错: 因为使用了 ES6 中用来传递异步消息的的Promise,而IE浏览器都不支持。 解决方法: 第一步: 安装 babel-polyfill 。 babel-polyfill可以模拟ES6使用的环境,可以使用ES6的所有新方法 第二步: 在 Webpack中使用 阅读全文
posted @ 2019-09-16 16:46 Gaochunling 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 前后端交互,后台不相信前端的校验,前端有时候也不要太依赖后台返回数,如若后台返回json数据不符合前端使用格式,那么就需要前端在接口请求返回值的地方进行统一处理。 对于javaScript遍历对象、数组的方法总结,方便今后参考使用! 1、使用Object.keys()遍历 ;返回一个数组,包括对象自 阅读全文
posted @ 2019-04-01 10:06 Gaochunling 阅读(5969) 评论(0) 推荐(0) 编辑
摘要: // 获取时间,格式YYYY-MM-DD export function getFormatDate (type) { const date = new Date() const year = date.getFullYear() let month = date.getMonth() + 1 let strDate = '' const seperator1 = '-' /... 阅读全文
posted @ 2019-03-29 11:04 Gaochunling 阅读(12081) 评论(0) 推荐(0) 编辑
摘要: 前端不管用那种框架,其中异步请求都可以使用axios插件进行封装,于此整理通用方法。并赋使用方法, 1、以vue为例封装,react同理 此处封装的文件为 globle.vue export default { request } export default { request } 2、vue项目 阅读全文
posted @ 2019-03-29 11:00 Gaochunling 阅读(782) 评论(0) 推荐(0) 编辑
摘要: // 时间差计算 function DateDiff (d1, d2, type) { let value switch (type) { case 'year': value = 365 * 24 * 60 * 60 * 1000 // 计算差多少年 break case 'day': value = 24 * 60 * 60 * 1... 阅读全文
posted @ 2019-03-29 10:31 Gaochunling 阅读(3447) 评论(0) 推荐(0) 编辑
摘要: 2、根据身份证号码自动获取出生日期 阅读全文
posted @ 2019-03-29 10:28 Gaochunling 阅读(503) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页