Typescript
Litwak
- 为 未 来 实 现 你 想 要 的 改 变 -
展开
-
ts 工厂模式
interface Shape { draw();}class Circle implements Shape { draw() { }}class Square implements Shape { draw() { }}class Rectangle implements Shape { draw() { }}// let c = new Circle(10, 10);// c.draw();// 工厂模式class ShapeFact.原创 2021-06-09 17:10:29 · 790 阅读 · 0 评论 -
柯里化
什么是柯里化?柯里化过程就是将多参数函数转换成单参数函数。我们从add函数开始原先的写法是:const add = (x, y) => x + y现在将其定义成如下写法:const add = x => y => x + y然后这样使用:add(1)(2) // 3const add1 = add(1) // 传入第一个参数后, 第一个值被保存起来,返回的函数可以复用add1(2) // 3***我是分割线***柯里化函数(某论坛看.原创 2020-12-12 13:58:23 · 284 阅读 · 0 评论 -
ng-zorro 日期时间合并组件
import { Component, forwardRef, ChangeDetectionStrategy } from '@angular/core';import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';import { ViewEncapsulation } from '@angular/compiler/src/core';@Component({ selector: 'app-date-t.原创 2020-09-30 11:09:28 · 578 阅读 · 0 评论 -
typescript add函数,要求参数类型相同,否则报错
const add = (...res: Array<string>|Array<number>) => { return res.reduce((total, num) => total + num, 0);}add(1, 2, 3);add('a', 'b', 'c');add('a', 1, 2);原创 2019-04-14 11:12:11 · 638 阅读 · 0 评论 -
angular clone deep
Installnpm install ng-clone-deep --saveexampleImport the module into every module where you want to use the components.import { NgCloneDeepModule } from 'ng-clone-deep/public-api';@NgModule({...原创 2019-04-17 16:23:18 · 884 阅读 · 0 评论 -
js的5个编程建议
5 Programming Patterns I Likejust some patternsMay 11 2019Photo by Desmond Simon on UnsplashIn this post I get into some patterns I try to use while programming. These patterns are observati...转载 2019-07-24 17:36:56 · 215 阅读 · 0 评论 -
lvy性能对比
1、新建一个项目lvy: --enable-ivyng new hy-bi-lvy --enable-ivy? Would you like to add Angular routing? Yes? Which stylesheet format would you like to use? Less [ http://lesscss.org ]常规:ng new t...原创 2019-08-07 11:53:48 · 907 阅读 · 1 评论