js
文章平均质量分 72
丑丑丫
这个作者很懒,什么都没留下…
展开
-
积累
将一个对象中的某些字段用‘-’拼接字符串/** 原始对象 */const viewRange = { ownPDeptName: 111, ownDeptName: 222, ownRoleName: 333, other: 'other'}/** 需要拼接的字段 */const needProp = ['ownPDeptName', 'ownDeptName', 'ownRoleName']function splitItem (props, obj) { return props原创 2020-06-04 17:18:42 · 122 阅读 · 0 评论 -
filter 和 map 做比较
高阶函数做比较filterlet a = [1,2,3];let b = a.filter((item)=>{item = item*2return item > 4;});console.log(‘bbbbb’,b,a); => b = [3], a = [1, 2, 3]maplet a = [1,2,3];let b = a.filter((i...原创 2019-07-09 11:48:54 · 561 阅读 · 2 评论 -
vuex的store结构
方案一 参考vuex官网storeindexmoduleschat.js 代码示例products.js不建议使用,每个文件可能会很大方案二 参考文章storeindexmoduleschat 示例actions.jsgetters.jsmutations.jsindex.jsproductsactions.jsgetters.js...原创 2019-01-28 23:00:47 · 447 阅读 · 0 评论 -
事件
绑到window上的事件一定要注意删除原创 2019-01-25 16:55:54 · 96 阅读 · 0 评论 -
图片适配容器大小
/** @params {imgBox} Number 图片容器的dom @params {thisImg} Number 图片的dom */ changeImage(imgBox, thisImg, url) { var maxWidth = imgBox.clientWidth var maxHeight = imgBox.clie...原创 2018-12-26 13:09:47 · 391 阅读 · 0 评论 -
面试总结
、、、let a = [1, 2 ,3]let b = a;b[2] = 9问:让b改变,a改变答案: 深拷贝、、、v-if v-show 区别v-if 直接操作dom节点是否在dom树中,v-show控制css的display属性兄弟组件间通信vuex;2.bus总线;3.$emit传递;缓存有几种以及区别localStore,cookie,session。loc...原创 2018-10-29 18:57:06 · 441 阅读 · 0 评论 -
格式化时间相关函数
20180903 -> 2018-09-03function formatStr(str,type){ let i = 0,_type = type || "xxxx-xx-xx xx:xx:xx"; return _type .replace(/x/g, () => { return str[i++]})}阿拉伯 转 中文 101 -> 一百...原创 2018-08-01 11:38:45 · 165 阅读 · 0 评论 -
js中“+”用法
https://www.w3cplus.com/javascript/javascriptss-addition-operator-demystified.html原创 2017-08-04 10:35:08 · 1244 阅读 · 0 评论 -
代码规范
http://alloyteam.github.io/CodeGuide/原创 2017-08-03 10:15:04 · 194 阅读 · 0 评论 -
收藏的组件
倒计时http://tutorialzine.com/2011/12/countdown-jquery/原创 2017-05-05 10:04:06 · 259 阅读 · 0 评论 -
angular 阻止事件冒泡
if($event.stopPropagation) $event.stopPropagation();if($event.preventDefult) $event.preventDefult();$event.cancelBubble = true;$event,.teturnValue = false;原创 2017-01-23 11:55:23 · 779 阅读 · 0 评论