JS
apjcui
这个作者很懒,什么都没留下…
展开
-
JS new Date()(获取当天、最近某段时间起止时间戳)
前端new Date()方法获取最近一天、最近一周起止时间以及 new Date()对象的相关方法原创 2019-12-18 13:19:42 · 4186 阅读 · 0 评论 -
MVC、MVP、MVVM三种模式的区别
一、MVC(model、view、controller):流程图:框架:比较早的backbone.js框架使用MVC模式。结构:model: 负责保存应用数据,与后端数据进行同步;view: 负责视图展示,将model中的数据记性可视化;controller: 负责业务逻辑,根据用户行为对model数据进行修改。问题:1.model和view的数据流混乱,维护麻烦;2.一些逻辑代码在view中增加,导致view体积过于庞大,而controller比较单薄。二、MVP(m原创 2020-10-26 12:01:36 · 431 阅读 · 0 评论 -
节流防抖
// js代码test = () => { if (this.timer) { clearTimeout(this.timer); this.timer = 0 } this.timer = setTimeout(() => { this.timer = 0 // 需要做防抖的操作 console.log(1) }, 500);}// 组件代码<button on原创 2020-09-18 17:16:04 · 398 阅读 · 0 评论 -
window.location跳转和window.open跳转以及从url地址栏获取参数
window.location跳转和window.open跳转1.跳转a.在当前页面跳转window.location = “/xxx/xxx/xxx?a=” + 参数1 + “&b=” + 参数2b.打开另一个新页面跳转window.open("/xxx/xxx/xxx")注意:1.window.location是页面的位置对象,而window.location.href是location的一个属性,并且是默认属性,也就是说直接给window.location赋值其实就是修改win原创 2020-05-28 08:55:25 · 3030 阅读 · 0 评论