![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
文章平均质量分 52
liy1wen
碌碌无为
展开
-
原生js上传图片
html: <input accept="image/*" type="file" class="myFileUpload" (change)="fileupload($event)" />js: fileupload(e) { var imgFile = e.target.files[0]; //获取图片文件 if(imgFile.size/1...原创 2020-03-06 19:33:08 · 171 阅读 · 0 评论 -
常用的js开发技巧
比较时间大小 const time1 = "2019-02-14 21:00:00"; const time2 = "2019-05-01 09:00:00"; const overtime = time1 > time2; // overtime => false 或者: compareDate(date1, date2) { var oDate1 ...原创 2020-02-28 14:32:25 · 149 阅读 · 0 评论 -
vue修改页面的title
在h5中,跳转页面会显示不同的页面标题。 routes: [ { path: '/', name: 'Entrance', component: Entrance, meta: { title: '首页入口' } } ] router.beforeEach((to, from, next) ...原创 2020-02-21 21:37:41 · 481 阅读 · 0 评论 -
获取天气信息
在工作中,有时候需要获取城市的天气情况,在这里给大家推荐一个免费查询天气的apihttps://www.tianqiapi.com/api/?appid=78877574&appsecret=TY93I915&version=v6详情可以点击appid和appsecret可以注册账号拿到...原创 2020-03-03 09:45:14 · 245 阅读 · 0 评论 -
常见数组去重的方法
常见数组去重的方法es6的set方法 function unique(arr) { return Array.from(new Set(arr)) }新建一个空的结果数组,for 循环原数组,判断结果数组是否存在当前元素,如果有相同的值则跳过,不相同则push进数组。 function unique(arr) { var newArr = []; ...原创 2019-12-23 21:06:52 · 80 阅读 · 0 评论 -
关于时间日期方面的常见转换
关于时间日期方面的常见转换获取当前日期,例如为yyyy-mm-dd function getDate(){ let time = new Date(); let y = new Date().getFullYear(); let m = time.getMonth() + 1 < 10 ? '0' + (time.getMont...原创 2019-12-23 20:17:18 · 176 阅读 · 0 评论