随笔分类 - Js
摘要:一、AMD (Asynchronous Module Definition) 什么是 AMD? AMD 是一种为浏览器环境设计的模块定义规范。它通过异步加载模块,解决了早期前端开发中 JavaScript 文件依赖关系复杂的问题。 require.js https://requirejs.org/d
阅读全文
摘要:实现类似 C# orderBy 和 thenBy 的 JavaScript 多字段排序 在开发过程中,我们经常需要对数组数据进行多字段排序。例如,我们可能希望先按姓名排序,如果姓名相同再按年龄排序,最后如果还相同,则按分数排序。这种需求在 C# 中通过 orderBy 和 thenBy 很容易实现。
阅读全文
摘要:效果如图: JS 如下: $.fn.extend({ pagination: function (opts) { // The default config const _defaultConfig = { page: 1, limit: 10, maxDisplayCount: 5, button
阅读全文
摘要:备份,后面做个整理 let zoneOverviewData = [] let sortFields = [] const getSortedRows = () => { let rows = [...zoneOverviewData]; const ascFields = sortFields .
阅读全文
摘要:这是一个简易版的 layui 模块定义和加载模块封装 layui github: https://github.com/layui/layui (function () { "use strict"; // 定义 layui 类 var Layui = function () { this.v =
阅读全文
摘要:js 获取当前脚本对象 对象类型:HTMLScriptElement // 获取当前脚本对象 var script = document.currentScript; console.log(script); // 获取所有js脚本对象 var jsScripts = doc.scripts; fo
阅读全文
摘要:// useProxy.js const useProxy = () => { const env_arr = ['document', 'window','navigator', 'localStorage'] const env = {} env_arr.forEach((value, inde
阅读全文
摘要:js 中 function 其实就是 class,function name 就是 class name; 在方法体中,想要实现继承的效果,可以通过 call 来实现: call 方法更改对象内部 this 的指向; function Animal(name){ this.name = name;
阅读全文

浙公网安备 33010602011771号