原文需要翻墻
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:red;" [style.color]="myColor" [style]="{color: myOtherColor}" myDirective>
-
之前 樣式優先級取決于 系結的時間 ,也就是最后一個系結會覆寫之前的系結
-
lvy 樣式優先級 和時間無關,越具體的系結優先級越高,比如 [style.color]會覆寫[style]
-
[ngStyle]
and[ngClass]的系結行為被保留 -
樣式系結代碼重構的副作用,可以在模版中系結c s s變數
-
<div [style.--main-border-color]=" '#CCC' "> <p style="border: 1px solid var(--main-border-color)">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
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/228889.html
標籤:其他
上一篇:CSS3+JS完美實作放大鏡模式
