06 2020 档案

摘要:1 function fnInitScreen() { 2 var html = document.getElementsByTagName("html")[0]; 3 var width = window.innerWidth; 4 var font_size = 0; 5 font_size = 阅读全文
posted @ 2020-06-18 10:16 PromiseOne 阅读(1048) 评论(0) 推荐(0) 编辑
摘要:添加@clcik.native 阅读全文
posted @ 2020-06-05 11:02 PromiseOne 阅读(234) 评论(0) 推荐(0) 编辑
摘要:let arr = []; let obj = {}; Object.prototype.toString.call(arr) '[object Object]' //判断对象 返回true Object.prototype.toString.call(obj) '[object Array]' / 阅读全文
posted @ 2020-06-04 11:29 PromiseOne 阅读(337) 评论(0) 推荐(0) 编辑
摘要:1. Vue 无法检测实例被创建时不存在于 data 中的 property 原因:由于 Vue 会在初始化实例时对 property 执行 getter/setter 转化,所以 property 必须在 data 对象上存在才能让 Vue 将它转换为响应式的。 场景: var vm = new 阅读全文
posted @ 2020-06-03 17:09 PromiseOne 阅读(1983) 评论(0) 推荐(1) 编辑
摘要:1 let arr= ['baidu', 'google', 'taobao']; 2 try{ 3 arr.forEach(item=>{ 4 if(item == 'google'){ 5 throw new Error(); 6 } 7 }) 8 }catch(e){ 9 return; 10 阅读全文
posted @ 2020-06-02 19:05 PromiseOne 阅读(1620) 评论(0) 推荐(0) 编辑
摘要:原因:JavaScript 中对象的赋值是默认引用赋值的(两个对象指向相同的内存地址) 解决方案1: 用 JSON.stringify 把对象转换成字符串,再用 JSON.parse 把字符串转换成新的对象 function deepClone(obj){ return JSON.parse(JSO 阅读全文
posted @ 2020-06-02 15:44 PromiseOne 阅读(2589) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示