随笔分类 - 常用/积累
摘要:for (let idx = 40; idx >0; idx--) { if (idx % 12 0) { // break; // 终止 // return; // 终止 continue; // 跳过 } console.log(idx); }
阅读全文
摘要:html: <ng-template #popTpl> <div> <p>title</p> <p>content</p> </div> </ng-template> ts: @ViewChild("popTpl") popTpl; constructor(private viewRef: View
阅读全文
摘要:// 双击全屏 全屏状态双击取消 window.addEventListener('dblclick', () => { if (document.fullscreenElement) { document.exitFullscreen(); } else { documnet.querySelec
阅读全文
摘要:web 浏览器页面实现滚屏效果 window 对象提供了执行动画的方法 window.requestAnimationFrame() 场景:固定位置显示多项内容列表 需要自动滚屏展示 demo: /** * 设置文本滚屏效果 */ setTextScroll(): void { const ulBo
阅读全文
摘要:function(str: string): string { return str.slice(0,1).toUpperCase() + str.slice(1); }
阅读全文
摘要:/** * 数组转字符串 */ const arr = [1, 3, 5, 7, 9]; // 方法1 const str1 = arr.toString(); // str1: 1,3,5,7,9 // 方法2 const str2 = arr.join('**'); // str2: 1**3*
阅读全文
摘要:/** * 数组删除指定项 * item: 要删除的项 * array:要执行删除项的数组 * code: 数组项的唯一字段 */ arrayRemoveItem(item, array, code?: string) { const idx = array.findIndex(ite => { r
阅读全文
摘要:/** * 获取url参数 * name: 可选项,获取某参数,如果不传参将返回参数对象 */ getUrlParams(name?) { const url = window.location.href; const paramList = url.split('?')[1]?.split('&'
阅读全文
摘要:i.e. 即,也就是 e.g. 例如(for example) as the name implies 顾名思义 coverage 发音:[`kʌvərɪdʒ] n:新闻报道;(书、课程学习、电视等的)信息范围,信息质量;提供的数据;覆盖范围(或方式); coverage rate:覆盖率[`kʌv
阅读全文