js判断类型
摘要:判断JS类型,有以下几种方法: typeof :可以判断基本类型,如:number,string,boolen、symbol、undefined、null等 2. instance of:只能用来判断复杂数据类型,如:数组,方法,对象等 object.prototype.toString.call:
阅读全文
posted @
2024-08-28 00:06
W-阿飞
阅读(42)
推荐(0) 编辑
虚拟列表
摘要:<template> <div ref="list" class="infinite-list-container" @scroll="scrollEvent($event)"> <div class="infinite-list-phantom" :style="{ height: listHei
阅读全文
posted @
2024-08-27 23:52
W-阿飞
阅读(5)
推荐(0) 编辑
vue全局指令按钮权限控制
摘要:方法一:指令.js // 注册一个全局自定义指令 `v-has-permission` Vue.directive('has-permission', { bind(el, binding, vnode) { // 获取绑定的权限值 const permission = binding.value;
阅读全文
posted @
2024-08-27 23:33
W-阿飞
阅读(219)
推荐(0) 编辑
淘宝flexible + rem
摘要:rem页面 <style> html { font-size: 100px; } div { /* 相对于 100px */ font-size: 1rem; } </style> <div> rem单位 </div> flexible <!DOCTYPE html> <html lang="en"
阅读全文
posted @
2024-08-27 21:49
W-阿飞
阅读(5)
推荐(0) 编辑
小功能
摘要:1.将内容复制到剪贴板 为了提高网站的用户体验,我们经常需要将内容复制到剪贴板,以便用户将其粘贴到指定位置。 const copyToClipboard = (content) => navigator.clipboard.writeText(content)copyToClipboard("Hel
阅读全文
posted @
2024-08-26 22:22
W-阿飞
阅读(7)
推荐(0) 编辑
CSS横竖屏
摘要:/* 竖屏时的样式 */@media screen and (orientation: portrait) { body { background-color: blue; /* 例如背景色为蓝色 */ }} /* 横屏时的样式 */@media screen and (orientation: l
阅读全文
posted @
2024-08-23 11:25
W-阿飞
阅读(29)
推荐(0) 编辑
去重方法
摘要:一、使用 Set JavaScript 的 Set 对象允许你存储唯一值,因此可以通过将数组转换为 Set 然后再转换回数组来去重。 const array = [1, 2, 2, 3, 4, 4, 5]; const uniqueArray = [...new Set(array)]; conso
阅读全文
posted @
2024-08-21 15:47
W-阿飞
阅读(10)
推荐(0) 编辑
常见算法
摘要:1.选择排序 思路如下: 在未排序序列中找到最小(大)元素,存放到排序序列的起始位置 从剩余未排序元素中继续寻找最小(大)元素,然后放到已排序序列的末尾。 重复第二步,直到所有元素均排序完毕 function selectionSort(arr) { var len = arr.length; va
阅读全文
posted @
2024-08-12 02:07
W-阿飞
阅读(10)
推荐(0) 编辑