Closed greengerong closed 7 years ago
component大部分是一致的,可以尝试利用npm创建目录和文件结构(DRY):
1:命令行输入component文件名(以“-”风格) 2:生成文件包括:app下的component目录、[component name].component.ts、[component name].html、[component name].scss、 index.ts 3:文件内容:
index.ts:
export * from './[component name].component';
[component name].component.ts:
import { Component, Input, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core'; import {Article} from '../article-service'; @Component({ selector: 'article-item', providers: [], directives: [], pipes: [], styles: [require('./article-item.scss')], template: require('./article-item.html') }) export class [component name(驼峰命名)] { constructor() { } }
[component name].html:
<div class="[component name](中划线分割)"> [component name] </div>
命令行文件组件生产,基于feature设计。
等待angular-cli项目release,然后迁移到此工具
Master brach changed to angular-cli version
component大部分是一致的,可以尝试利用npm创建目录和文件结构(DRY):
index.ts:
[component name].component.ts:
[component name].html:
命令行文件组件生产,基于feature设计。