随笔分类 - code
摘要:https://github.com/tim-kos/node-retry (npm install retry) const retry = require('retry') const delay = require('delay') const isItGood = [false, false
阅读全文
摘要:<div class="container"> <img src="loading.gif" data-src="pic.png"> <img src="loading.gif" data-src="pic.png"> <img src="loading.gif" data-src="pic.png
阅读全文
摘要:<template> <div class="list-wrapper" ref="allListRef"> <div v-if="showArrow && listSource.length > minArrowItemsCount" @click="scrollLeft" class="arro
阅读全文
摘要:宫格布局第一种:.template-list { width: 100%; border-radius: 4px; height: 202px; display: grid; grid-template-columns: repeat(4, 94px); gap: 8px; overflow-y:
阅读全文
摘要:1. ?? 非空运算符 在 JS 中,?? 运算符被称为非空运算符。如果第一个参数不是 null/undefined(译者注:这里只有两个假值,但是 JS 中假值包含:未定义 undefined、空对象 null、数值 0、空数字 NaN、布尔 false,空字符串’’,不要搞混了),将返回第一个参
阅读全文
摘要:<template> <div class="count-to-wrapper"> <slot name="left"/> <p class="content-outer"><span :class="['count-to-count-text', countClass]" :id="counter
阅读全文
摘要:需求: 从接口动态获取子菜单数据 动态加载 要求只有展开才加载子菜单数据 支持刷新,页面显示正常 思路: 一开始比较乱,思路很多。想了很多 首先路由和菜单共用一个全局route, 数据的传递也是通过store的route, 然后要考虑的俩个点就是一个就是渲染菜单和加载路由,可以在导航首位里处理路由,
阅读全文
摘要:$(function () { const models = [ {id: 1, title: 'hello', parent: 0}, {id: 3, title: 'hello', parent: 1}, {id: 4, title: 'hello', parent: 3}, {id: 5, t
阅读全文
摘要:1.文字渐变color:#DBA465; background-image: linear-gradient(to bottom, #fffefc 20%, #fdd050); -webkit-background-clip: text; background-clip: text; -webkit
阅读全文
摘要:const path = require('path'); const cwd = process.cwd(); const VueLoaderPlugin = require('vue-loader/lib/plugin'); const { getHtmlWebpackPlugins, getE
阅读全文
摘要:<template> <div id="infiniteScroll" class="infinite-scroll"> <slot></slot> </div> </template> <script> /** * 用法: * 将该组件放在列表最下方,其直接父级元素为滚动的包含块 * window
阅读全文
摘要:1.锚点链接 2.document.getElementById(rewardid).scrollIntoView(); 3. Math.easeout = function (A, B, rate, callback) { if (A == B || typeof A != 'number') {
阅读全文
摘要:html, body, ul, li, p, h1, h2, h3, h4, h5, h6 { margin: 0; padding: 0; } ::-webkit-scrollbar { display: none; } ul, li { list-style: none; } html { height: 100%; min-height: 100%; } b...
阅读全文
摘要:1.删除重复项 var fruits = [“banana”, “apple”, “orange”, “watermelon”, “apple”, “orange”, “grape”, “apple”]; // First method var uniqueFruits = Array.from(n
阅读全文
摘要:function unique (arr) { return Array.from(new Set(arr)) } var arr = [1,1,'true','true',true,true,15,15,false,false, undefined,undefined, null,null, NaN, NaN,'NaN', 0, 0, 'a', 'a',{},{}]; console.lo...
阅读全文
摘要:// 方法一 function toThousands(num) { var result = [ ], counter = 0; num = (num || 0).toString().split(''); for (var i = num.length - 1; i >= 0; i--) { counter++; result.unshift(num[i]); if (!(counter %
阅读全文
摘要:http_path = ''; /** * 是否相等 */ function equals(obj1, obj2) { if (obj1 == obj2) return true; if (typeof (obj1) == "undefined" || obj1 == null || typeof
阅读全文
摘要:## normalize.css 中文版 normalize.css 原地址:http://necolas.github.io/normalize.css/reset 太暴力了,这个 normalize 相对要温柔很多。译文与原文中空了一行。
阅读全文
摘要:(function(win, doc, docEl) { function setRem() { var width = docEl.getBoundingClientRect().width; var rem = width / 10; win.rem = rem; docEl.style.fon
阅读全文
摘要:// Underscore.js 1.8.3 // http://underscorejs.org // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // Underscore may be freely distributed under t...
阅读全文