随笔分类 - 前端
摘要:<!DOCTYPE html> <html> <head> <style> .title span { background: linear-gradient(to right, #ec6b5f, #61c554) no-repeat; background-size: 0 2px; backgro
阅读全文
摘要:localeCompare: localeCompare方法详细介绍: JavaScript localeCompare() 方法 问题描述: 使用localeCompare对一个字符串数组按名称排序 const arr = ['我','B','c','C','b','玩手机','233','102
阅读全文
摘要:JS代码: /** * 要求格式yyyy-MM * @param {Object} currentMonth 当前月份 */ function getCalendar(currentMonth) { if(currentMonth.indexOf("-") < 0) { return; } var
阅读全文
摘要:由于项目需要,需要在不调用后台接口的情况下,将json数据导出到excel表格,参考了好多资料以及很多大佬写的博客终于实现,兼容chrome没问题,其他还没有测试过,这边介绍两种实现方式,并附上代码和gif动图,博主不才还望轻喷,代码可直接copy运行 方法一 将table标签,包括tr、td等对j
阅读全文
摘要:html代码 <div class="cross"></div> css代码 .cross{ width: 20px; height: 20px; background-color: #F3F9FF; border-radius: 10px; border: 1px solid #DBE6EF; d
阅读全文
摘要:代码1: input[type="checkbox"] { width: 20px; height: 20px; display: inline-block; text-align: center; vertical-align: middle; line-height: 18px; margin-
阅读全文
摘要:padStart() padStart(maxLength: number, fillString?: string): string; maxLength:最大的长度,当小于字符串少于这个长度是,会在字符串头部使用fillString(第二个参数)进行填充,直到达到最大长度。 fillString
阅读全文
摘要:html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>分页</title> <script src="pagenation.js"></script> <style type="text/css"> * { margin:
阅读全文
摘要:<body> <div class="firstBox"> <div class="box"> <div class="btn"></div> <input type="text" id="cph" value="" /> </div> <div class="content"> </div> </
阅读全文
摘要:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> * { margin: 0; padding: 0; list-style: none; } .box { bor
阅读全文
摘要:一、原生JS forEach()和map()遍历 共同点: 都是循环遍历数组中的每一项。 forEach() 和 map() 里面每一次执行匿名函数都支持3个参数:数组中的当前项item,当前项的索引index,原始数组array。 匿名函数中的this都是指Window。 只能遍历数组。 forE
阅读全文
摘要:原始数据: 需求是: 在所有的经纬度后面加个z轴的值,值为0, {"x":"145.25" , "y":"34.555"} 变成 {"x":"145.25" , "y":"34.555" ,"z" : "0"} 方法:使用正则表达式和replaceAll函数 正则表达式修饰符 修饰符 可以在全局搜索
阅读全文
摘要:<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8" /> <title>Document</title> <script src="https://lib.sinaapp.com/js/jquery/2.0.2/jquery-2
阅读全文
摘要:Less代码: @globalColor: #ececec; @property-color: color; @width: 300px; @color: red; .flex_row() { display: flex; justify-content: space-between; align-
阅读全文
摘要:通过js在控制台输出彩色字体 代码: var e = "%c"; var n = "color:red;text-shadow:5px 5px 2px #fff, 5px 5px 2px #373E40, 5px 5px 5px #A2B4BA, 5px 5px 10px #82ABBA;font-
阅读全文
摘要:axios相关使用 一、axios安装 使用npm安装axios npm install axios 使用cnpm安装axios cnpm install axios 使用yarn安装axios yarn install axios 使用cdn链接axios <script src="https:/
阅读全文
摘要:IndexedDB 中文教程 https://www.tangshuang.net/3735.html 续: <script type="text/javascript"> const request = window.indexedDB.open('mydb', 1); let db; reque
阅读全文
摘要:IndexedDB 中文教程 https://www.tangshuang.net/3735.html 简单的示例: <script type="text/javascript"> /** * IndexedDB * */ var db; /*数据库对象*/ var objectStore; /*仓
阅读全文
摘要:1、serialize() 方法: serialize() 方法通过序列化表单值,创建 URL 编码文本字符串。 您可以选择一个或多个表单元素(比如 input 及/或 文本框),或者 form 元素本身。 序列化的值可在生成 AJAX 请求时用于 URL 查询字符串中,这样在ajax提交表单数据时
阅读全文
摘要:css: * { padding: 0; margin: 0; list-style: none; } .xiehContent { width: 450px; height: 602px; border: 1px solid red; margin-left: 10px; margin-top:
阅读全文