上一页 1 2 3 4 5 6 7 8 9 ··· 27 下一页
摘要: isNaN(parseFloat(value)) && isFinite(value); 参考链接:https://blog.csdn.net/qq_23365135/article/details/123833406 阅读全文
posted @ 2023-02-08 11:53 蓓蕾心晴 阅读(31) 评论(0) 推荐(0) 编辑
摘要: flat 函数第一个参数为需要扁平化的数组,第二个参数为需要打平的层数,默认不传则打平一层,传入几则代表打平几层。 测试用例 const arr = [1, [2], [3, [4, [5]]]]; console.log(flat(arr)); // [1, 2, 3, [4,[5]]] cons 阅读全文
posted @ 2023-02-08 11:39 蓓蕾心晴 阅读(616) 评论(0) 推荐(0) 编辑
摘要: 在 vue 中,如果想在页面中展示格式化后的 json 数据,首先需要先将 json 字符串转化为 json 对象,而后通过 pre 标签 插值即可展示。代码示例如下: <script setup lang="ts"> import { ref } from "vue"; const jsonVal 阅读全文
posted @ 2023-02-07 15:16 蓓蕾心晴 阅读(1864) 评论(0) 推荐(0) 编辑
摘要: 创建二维响应式数组 const caculatorList = ref([[] as caculatorType[]]); 赋值 caculatorList.value = [ [ { value: "0", type: "number", bgColor: "#aaa" }, { value: " 阅读全文
posted @ 2023-02-03 17:24 蓓蕾心晴 阅读(1158) 评论(0) 推荐(0) 编辑
摘要: 子路由的地址如果是希望拼接父路由地址,子路由的 path 仅写名称,不写 “/”,如果希望是另外的地址,则直接以 “/” 开头。 { path: "/lifetools", name: "lifetools", component: () => import(/* webpackChunkName: 阅读全文
posted @ 2023-02-03 14:01 蓓蕾心晴 阅读(288) 评论(0) 推荐(0) 编辑
摘要: vite中导入基础样式文件,以供在全局下直接使用全局 less 变量,否则会报错 undefined 先新建 base.less 文件,定义基础样式变量 在 vite.config.ts 下 添加配置 import { defineConfig } from "vite"; import vue f 阅读全文
posted @ 2023-02-02 17:56 蓓蕾心晴 阅读(1101) 评论(0) 推荐(0) 编辑
摘要: <script setup lang="ts"> import { ref, onMounted } from "vue"; onMounted(() => { transferTextarea.value.textarea.select(); }); </script> <el-input v-m 阅读全文
posted @ 2023-02-02 13:49 蓓蕾心晴 阅读(585) 评论(0) 推荐(0) 编辑
摘要: 1 .原生js获取 DOM 节点 document.querySelector(选择器) document.getElementById(id选择器) document.getElementsByClassName(class选择器) .... 2. vue2中获取当前组件的实例对象 因为每个 vu 阅读全文
posted @ 2023-02-02 12:01 蓓蕾心晴 阅读(919) 评论(0) 推荐(0) 编辑
摘要: vite.config.ts import { resolve } from "path"; export default defineConfig({ resolve: { alias: { "@": resolve(__dirname, "./src"), //把 src 的别名设置为 @ }, 阅读全文
posted @ 2023-01-31 16:05 蓓蕾心晴 阅读(279) 评论(0) 推荐(0) 编辑
摘要: vue3 中如何实现数组响应式,即数据更改,页面实时更新? type dateObj = { title: String; days: Number; date: String; }; 方法一:ref let dataList = ref([] as dateObj[]); // 通过 dataLi 阅读全文
posted @ 2023-01-30 15:52 蓓蕾心晴 阅读(5391) 评论(0) 推荐(1) 编辑
摘要: 1.Date.parse() 参考自文档:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Date/parse Date.parse() 方法解析一个表示某个日期的字符串,并返回从 19 阅读全文
posted @ 2023-01-30 11:39 蓓蕾心晴 阅读(3758) 评论(0) 推荐(0) 编辑
摘要: 在工作中,用到了 mraid.js 库,其中封装了事件监听逻辑,代码如下: var EventListeners = function (event) { this.event = event; this.count = 0; var listeners = {}; this.add = funct 阅读全文
posted @ 2023-01-11 17:18 蓓蕾心晴 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 有时候一些项目中会使用类似如下的方式覆盖掉console对象: var console = {}; console.log = function(){}; console.info = function(){}; window.console = console; 这个时候如果需要在控制台调试一些接 阅读全文
posted @ 2023-01-10 12:53 蓓蕾心晴 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 1. 定义window.onerror全局事件函数 window.onerror = function(message, source, lineno, colno, error) { ... } / * * message:错误信息(字符串)。可用于HTML onerror=""处理程序中的eve 阅读全文
posted @ 2022-12-29 18:14 蓓蕾心晴 阅读(2389) 评论(0) 推荐(0) 编辑
摘要: 写在前面 在前端监控 sdk 开发中,我们都会用到错误捕获,将页面各类错误进行捕获并上报日志,来获取错误信息,所以我们非常有必要深入了解下各类错误的错误捕获方式。 补充 setTimeout 错误捕获方式:https://www.cnblogs.com/beileixinqing/p/1698767 阅读全文
posted @ 2022-12-29 17:18 蓓蕾心晴 阅读(2723) 评论(0) 推荐(0) 编辑
摘要: // 方法一:从左到右迭代,从高位判断,返回高位的大小结果 注意:仅适用于版本号各个位的位数相同 let versions = ["1.45.0", "1.5", "6", "2.3.4.5"]; versions = versions.sort((a, b) => { let arr1 = a.s 阅读全文
posted @ 2022-12-29 14:41 蓓蕾心晴 阅读(872) 评论(0) 推荐(0) 编辑
摘要: webpack5 内置了缓存配置 在 webpack 配置对象下,增加: cache: { type: 'filesystem', allowCollectingMemory: true } webpack5 可以通过引入 thread-loader 来开启多线程 { test: /\.js$/, 阅读全文
posted @ 2022-12-28 11:22 蓓蕾心晴 阅读(972) 评论(0) 推荐(0) 编辑
摘要: 一、将对象转为字符串比较 这是最容易想到的方法,主要使用JSON.stringify()这个方法对对象进行强转: var a={}; var b=new Object(); console.log(JSON.stringify(a)=="{}") //true console.log(JSON.st 阅读全文
posted @ 2022-12-27 15:07 蓓蕾心晴 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 问题: 安装 nvm 后,运行 nvm 命令,依然为,nvm: command not found 原因应该为: 系统是最新更新的 macOS Catalina 系统,默认的 shell 是 zsh,所以找不到配置文件 解决方案: # 1.新建一个 .zshrc 文件(如果没有的话) touch ~ 阅读全文
posted @ 2022-12-20 01:08 蓓蕾心晴 阅读(1627) 评论(0) 推荐(0) 编辑
摘要: 方法一 全局重写 setTimeout function overrideSetTimeout(fn){ return function(callback, delay, params){ var _callback = function(){ try{ callback(); }catch(err 阅读全文
posted @ 2022-12-16 16:15 蓓蕾心晴 阅读(465) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 27 下一页