随笔分类 - JavaScript
原生javascript
摘要:前端 function sendRequest() { // const Appid = "1313203058"; // const SecretId = "AKID60e2B3ez3btufAOL1QYP0KOAn9F4cuvg"; // const SecretKey = "WmlTt4ybx
阅读全文
摘要:<template> <div> <input type="file" id="fileInput" /> <button @click="uploadFile()">Upload File</button> </div> </template> <script setup> import axio
阅读全文
摘要:小程序支持 // 小程序支持 const requestTask = uni.request({ url: "http://192.168.1.66/chat/sse", timeout: 15000, responseType: "text", method: "post", enableChun
阅读全文
摘要:import sm from "sm-crypto"; // 注意加这个包起来 key 和 iv const text = new TextEncoder(); console.log( 123, sm.sm4.decrypt( "0932d0497791aa94ba067fb0256cb4c5c3
阅读全文
摘要:区别 CRLF:回车换行符,即"\r\n"。在Windows系统中,文本文件的每一行都以CRLF结尾。 LF:换行符,即"\n"。在Unix和Linux等系统中,文本文件的每一行都以LF结尾。 因此,CRLF和LF的主要区别在于它们在文本文件中的使用方式。 在Windows系统中,文本编辑器和其他应
阅读全文
摘要:window.onload = function () { var op = document.querySelector('#submitBtn1'); op.onmouseover = function () { this.style.color = "#f58220"; }; op.onmou
阅读全文
摘要:原型链继承 、借用构造函数继承 、组合继承 、原型式继承、 寄生式继承、 寄生组合式继承
阅读全文
摘要:输入: [4,1,2,1,2] 输出: 4 var singleNumber = function(arr) { const first = arr[0] for (let i = 1; i < arr.length; i++) { if (first arr[i]) { arr.shift() a
阅读全文
摘要:// 可选链 ?. 的为空判断 let a, b; /* 使用前 */ if (!!a) { b.name = 123; } else { b = undefined; } // 使用后 b = a?.name; console.log(b); 和运算符&&类似 console.log(1 && 2
阅读全文
摘要:replace正则匹配方法 去除字符串内所有的空格:str = str.replace(/\s*/g,""); 去除字符串内两头的空格:str = str.replace(/^\s*|\s*$/g,""); 去除字符串内左侧的空格:str = str.replace(/^\s*/,""); 去除字符
阅读全文
摘要:option参数说明 术语查询手册 https://echarts.apache.org/zh/cheat-sheet.html X轴/Y轴(他们的选项一致) xAxis/yAxis: { name:'名称', // 名称 // 坐标轴名称的文字样式 nameTextStyle: { color:
阅读全文
摘要:vue引入 封装 import * as echarts from 'echarts' // 绘制图表 export default function initEcharts(dom, config) { let myChart = echarts.init(document.querySelect
阅读全文
摘要:// 获取中文字符首字母拼音 export function pinyin (raw) { const str = `${raw}` if (!str || /^ +$/g.test(str)) { return '' } let result = [] for (let i = 0; i < st
阅读全文
摘要:配置tsconfig.json // 编译选项 "compilerOptions": { "noImplicitThis": false, // 忽略 this 的类型检查, Raise error on this expressions with an implied any type. } 配置
阅读全文
摘要:// 情况1 (正常形参和实参) let fun1 = function(param) { // console.log(arguments); // 打印出[Arguments] { '0': 12 } { '0': 12 } // 可以用 Array.from() 转换成数组 或者for in
阅读全文
摘要:首先动态创建一个input上传的按钮(在console控制台中) 然后动态创建一个ajax请求 在请求中创建一个formData对象进行文件上传处理 里面的上传地址 可以自己点击掘金的上传按钮在network看得到 创建按钮 const input = document.createElement(
阅读全文
摘要:1. 声明变量 //Longhand let x; let y = 20; //Shorthand let x, y = 20; 2. 给多个变量赋值 我们可以使用数组解构来在一行中给多个变量赋值。 //Longhand let a, b, c; a = 5; b = 8; c = 12; //Sh
阅读全文
摘要:元素, html文档里面,所有的标签都可以称之为元素 比如说<p> <tr>等,也就是说元素是个统称,一个文档里面有很多的元素 节点, 是js.为了对html文档进行操作,而开发的,即DOM(文档对象模型)。 每个元素都可以称之为一个节点,节点是唯一的。 总之,元素是统称,节点是具有唯一性的。 元素
阅读全文
摘要:折线图的单位转换 Y轴的单位转换
阅读全文
摘要:const elementsAreEqual = array => array.every(el => el array[0]) // 事例 elementsAreEqual([9, 8, 7, 6, 5, 4]) // false elementsAreEqual([4, 4, 4, 4, 4])
阅读全文