2020年12月2日星期三

ng9新特性 lvy出场

原文需要翻墙
lvy带来的优势

  • Smaller bundle sizes

    • 无用的代码会被tree-shaking掉;为每个组件生成更少的代码
  • Faster testing

    • 测试速度提升,lvy不会重新编译所有组件除非被手动覆盖
  • Better debugging

    • 在控制台使用ng可以拿到组件(ng.getComponent(document.getElementsByTagName('组件tag名字')[0])),指令等的实例
    • 然后可以手动调用组件的方法,更新组件状态
    • ng.applyChanges可以手动触发变更检测
    • 改善错误栈追踪
  • Improved CSS class and style binding

    • 优化样式绑定

    • 比如

    • <my-component [style.color]="myColor" [style]="{color: myOtherColor}" myDirective>

    • 之前 样式优先级取决于 绑定的时间 ,也就是最后一个绑定会覆盖之前的绑定

    • lvy 样式优先级 和时间无关,越具体的绑定优先级越高,比如 [style.color]会覆盖[style]

    • [ngStyle]and[ngClass]的绑定行为被保留

    • 样式绑定代码重构的副作用,可以在模版中绑定c s s变量

    • <div [style.--main-border-color]=" '#CCC' "> <p >hi</p></div>

      c s s变量以 -- 开头

  • Improved type checking

    • 完善了类型检查
    • 增加了两种而外的类型检查机制
    • fullTemplateTypeCheck: 检查模版里的所有变量
    • strictTemplates: 使用最严格的类型检查
  • Improved build errors

    • 使错误信息可读性更强
  • Improved build times, enabling AOT on by default

    • 默认使用aot编译
    • 不需要再使用entryComponents
  • Improved Internationalization

    语言服务的启动时间快10倍

  • @Injectable({providedIn: })

    • providedIn除了原来的 'root'和模块名字还有两个选项
    • any 为每个子注入器注入隔离的服务,非单例
    • platform 提供多个应用共享的服务
  • component harnesses

    • Most of Angular Material's components can now be tested via harnesses, and we are making harnesses available to any component author as part of the Component Dev Kit (CDK).
    • [使用harnesses测试 angular material组件][https://v9.material.angular.io/guide/using-component-harnesses]
  • YouTube and Google Maps

    • 在你的应用中可以使用 youtube-player和 google-maps的能力
  • Visual Studio 的angular 语法支持扩展: Angular Language Service

  • 支持TypeScript 3.7









原文转载:http://www.shaoqun.com/a/494641.html

孙琦:https://www.ikjzd.com/w/1638

1号团:https://www.ikjzd.com/w/2263

启明星:https://www.ikjzd.com/w/1436


原文需要翻墙lvy带来的优势Smallerbundlesizes无用的代码会被tree-shaking掉;为每个组件生成更少的代码Fastertesting测试速度提升,lvy不会重新编译所有组件除非被手动覆盖Betterdebugging在控制台使用ng可以拿到组件(ng.getComponent(document.getElementsByTagName('组件tag名字')[
邮乐购物商城:邮乐购物商城
zen cart:zen cart
韶关梅岭古道门票是多少?:韶关梅岭古道门票是多少?
爆炸好消息 ! 韩国最大电商平台Gmarket对中国卖家开放招商!:爆炸好消息 ! 韩国最大电商平台Gmarket对中国卖家开放招商!
塞班岛餐饮-卡里迪欧斯 - :塞班岛餐饮-卡里迪欧斯 -

没有评论:

发表评论