Angular 1.5/2.0 组件,推荐前缀?
Angular 1.5/2.0 Components, recommended to prefix?
创建新的 Angular 1.5 或 2.0 组件时,我是否仍应使用 3 个字母作为组件名称的前缀
abc-my-component
abc 是为了避免与其他组件重复的名称?
我不确定这是否仍然有必要,而且我在野外没有看到很多用途。
我该往哪个方向走?
Do use a prefix that identifies the feature area or the app itself.
此外,您可能希望查看 Angular Material 库(v1 和 v2)。它们被建造成某种规范的图书馆。那里的组件都使用 'md' 前缀。
This recommendation 来自 angular2 团队
"We recommend picking a selector name with a prefix to ensure that it cannot conflict with any standard HTML attribute, now or in the future. There is also less risk of colliding with a third-party directive name when we give ours a prefix."
继续使用前缀也会让团队知道代码中使用了什么 quickly。
在我的团队中,我们使用两种前缀
我们希望将来可以在其他项目中重用的常见 ui 组件的前缀作为公司名称的简称。
前缀作为项目业务域组件的项目名称的简称。
但我们保持简短,通用 ui 组件最多 3 个字母,业务组件最多 3 个字母。
大多数 ui 组件使用它,例如 igniteui 与 ig,ionic 与 ion,onsen ui 与 ons,...
创建新的 Angular 1.5 或 2.0 组件时,我是否仍应使用 3 个字母作为组件名称的前缀
abc-my-component
abc 是为了避免与其他组件重复的名称?
我不确定这是否仍然有必要,而且我在野外没有看到很多用途。
我该往哪个方向走?
Do use a prefix that identifies the feature area or the app itself.
此外,您可能希望查看 Angular Material 库(v1 和 v2)。它们被建造成某种规范的图书馆。那里的组件都使用 'md' 前缀。
This recommendation 来自 angular2 团队
"We recommend picking a selector name with a prefix to ensure that it cannot conflict with any standard HTML attribute, now or in the future. There is also less risk of colliding with a third-party directive name when we give ours a prefix."
继续使用前缀也会让团队知道代码中使用了什么 quickly。
在我的团队中,我们使用两种前缀
我们希望将来可以在其他项目中重用的常见 ui 组件的前缀作为公司名称的简称。
前缀作为项目业务域组件的项目名称的简称。
但我们保持简短,通用 ui 组件最多 3 个字母,业务组件最多 3 个字母。
大多数 ui 组件使用它,例如 igniteui 与 ig,ionic 与 ion,onsen ui 与 ons,...