2024年8月28日
摘要: 判断JS类型,有以下几种方法: typeof :可以判断基本类型,如:number,string,boolen、symbol、undefined、null等 2. instance of:只能用来判断复杂数据类型,如:数组,方法,对象等 object.prototype.toString.call: 阅读全文
posted @ 2024-08-28 00:06 W-阿飞 阅读(2) 评论(0) 推荐(0) 编辑
  2024年8月27日
摘要: <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-阿飞 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 方法一:指令.js // 注册一个全局自定义指令 `v-has-permission` Vue.directive('has-permission', { bind(el, binding, vnode) { // 获取绑定的权限值 const permission = binding.value; 阅读全文
posted @ 2024-08-27 23:33 W-阿飞 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 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-阿飞 阅读(1) 评论(0) 推荐(0) 编辑
  2024年8月26日
摘要: 1.将内容复制到剪贴板 为了提高网站的用户体验,我们经常需要将内容复制到剪贴板,以便用户将其粘贴到指定位置。 const copyToClipboard = (content) => navigator.clipboard.writeText(content)copyToClipboard("Hel 阅读全文
posted @ 2024-08-26 22:22 W-阿飞 阅读(1) 评论(0) 推荐(0) 编辑
  2024年8月23日
摘要: /* 竖屏时的样式 */@media screen and (orientation: portrait) { body { background-color: blue; /* 例如背景色为蓝色 */ }} /* 横屏时的样式 */@media screen and (orientation: l 阅读全文
posted @ 2024-08-23 11:25 W-阿飞 阅读(1) 评论(0) 推荐(0) 编辑
  2024年8月21日
摘要: 一、使用 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-阿飞 阅读(1) 评论(0) 推荐(0) 编辑
  2024年8月12日
摘要: 1.选择排序 思路如下: 在未排序序列中找到最小(大)元素,存放到排序序列的起始位置 从剩余未排序元素中继续寻找最小(大)元素,然后放到已排序序列的末尾。 重复第二步,直到所有元素均排序完毕 function selectionSort(arr) { var len = arr.length; va 阅读全文
posted @ 2024-08-12 02:07 W-阿飞 阅读(2) 评论(0) 推荐(0) 编辑
  2024年7月28日
摘要: 1. 父组件向子组件传递数据 (Props) 这是最基本也是最常用的通信方式。父组件通过属性向子组件传递数据。 「父组件:」 <template> <child :name="name"></child></template><script setup>import { ref } from 'vu 阅读全文
posted @ 2024-07-28 00:19 W-阿飞 阅读(17) 评论(0) 推荐(0) 编辑
  2024年7月27日
摘要: 1.默认插槽 // 子组件 <template> <div> <slot></slot> </div> </template> // 父组件 <template> <ChildComponent> <p>这是插槽中的内容</p> </ChildComponent> </template> 2.具名插 阅读全文
posted @ 2024-07-27 18:24 W-阿飞 阅读(1) 评论(0) 推荐(0) 编辑