2021年12月8日

Vue 实现自定义指令

摘要: 分3步实现一个简单的Vue自定义指令 1.创建一个存放自定义指令的js文件,写好我们想要的功能(以修改样式为例),具体代码如下: 注:css带有横杠( - )的属性应写为驼峰命名 export const abc = (el) => { el.style.backgroundColor = 'blu 阅读全文

posted @ 2021-12-08 16:39 赵敏皓 阅读(277) 评论(0) 推荐(0) 编辑

JavaScript实用小技巧(1)

摘要: 1.平滑回到顶部 document.body.scrollIntoView({behavior:'smooth'}) 2.按位取反 ~a 即:返回 -(a+1),会去掉小数点 let a = 3.14; let b = ~a; //b = -(3.14+1) 取整 为-4; let c = ~b; 阅读全文

posted @ 2021-12-08 15:27 赵敏皓 阅读(24) 评论(0) 推荐(0) 编辑

导航