Skip to content

Commit 377eb1b

Browse files
committed
feat: add barrel & header.component.ts
1 parent 43436d4 commit 377eb1b

18 files changed

+82
-88
lines changed

package.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
},
1313
"license": "MIT",
1414
"devDependencies": {
15-
"awesome-typescript-loader": "~0.16.2",
16-
"source-map-loader": "^0.1.5",
17-
"typescript": "~1.8.9",
18-
"typings": "^0.7.9",
15+
"@types/core-js": "~0.9.34",
16+
"source-map-loader": "~0.1.5",
17+
"ts-loader": "~1.2.1",
18+
"typescript": "~2.0.0",
1919
"webpack": "^1.12.9",
20-
"webpack-dev-server": "^1.14.0",
20+
"webpack-dev-server": "~1.14.0",
2121
"webpack-merge": "^0.8.4"
2222
},
2323
"dependencies": {
@@ -29,13 +29,11 @@
2929
"@angular/platform-browser": "2.0.0",
3030
"@angular/platform-browser-dynamic": "2.0.0",
3131
"@angular/router": "3.0.0",
32-
"@angular/upgrade": "2.0.0",
33-
34-
"core-js": "^2.4.1",
35-
"reflect-metadata": "^0.1.3",
36-
"rxjs": "5.0.0-beta.12",
37-
"zone.js": "^0.6.23",
3832
"angular2-in-memory-web-api": "0.0.20",
39-
"bootstrap": "^3.3.6"
33+
"bootstrap": "~3.3.6",
34+
"core-js": "~2.4.1",
35+
"reflect-metadata": "~0.1.3",
36+
"rxjs": "5.0.0-beta.12",
37+
"zone.js": "~0.6.23"
4038
}
4139
}

src/app/app.module.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,23 @@ import {HttpModule} from "@angular/http";
77
import {rootRouterConfig} from "./app.routes";
88
import {AppComponent} from "./app.component";
99

10-
import {CollectionComponent} from './collection/collection.component';
11-
import {ListComponent, ItemComponent} from './list';
10+
import {CollectionComponent} from './collection';
11+
import {ListComponent, ListItemComponent} from './list';
1212
import {DetailComponent} from './detail';
13-
import {EditComponent} from './edit/edit.component';
13+
import {EditComponent} from './edit';
1414

15-
import {ContactService} from "./shared/contact.service";
16-
import {FooterComponent} from './shared/footer.component';
17-
import {PhonePipe} from './shared/phone.pipe';
18-
import {BtnClickDirective} from './shared/btn-click.directive';
19-
import {UtilService} from './shared/util.service';
15+
import {ContactService, UtilService, FooterComponent,
16+
HeaderComponent, PhonePipe, BtnClickDirective} from "./shared";
2017

2118

2219
@NgModule({
2320
declarations: [
2421
AppComponent,
25-
ListComponent,
22+
ListComponent, ListItemComponent,
2623
DetailComponent,
2724
CollectionComponent,
2825
EditComponent,
29-
FooterComponent,
30-
ItemComponent,
26+
HeaderComponent, FooterComponent,
3127
PhonePipe,
3228
BtnClickDirective
3329
],

src/app/app.routes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {Routes} from "@angular/router";
22

3-
import {CollectionComponent} from './collection/collection.component';
4-
import {ListComponent, ItemComponent} from './list';
5-
import {DetailComponent, AnotationComponent} from './detail';
6-
import {EditComponent} from './edit/edit.component';
3+
import {CollectionComponent} from './collection';
4+
import {ListComponent} from './list';
5+
import {DetailComponent} from './detail';
6+
import {EditComponent} from './edit';
77

88

99
export const rootRouterConfig: Routes = [

src/app/collection/collection.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h3 class="collection-header">我的收藏</h3>
1+
<my-header title="我的收藏"></my-header>
22
<h3 *ngIf="coll_length == 0" class="no-collection">没有收藏</h3>
33
<ul class="my-collection">
44
<li *ngFor="let collection of collections">

src/app/collection/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./collection.component";

src/app/edit/edit.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h3 class="new-contact">{{operateTitle}}</h3>
1+
<my-header [title]="operateTitle"></my-header>
22
<div class="operate">
33
<form #contactForm="ngForm" (ngSubmit)="submitForm()">
44
<ul>

src/app/edit/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './edit.component';

src/app/list/item.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
22
import {Router} from '@angular/router';
33

44
@Component({
5-
selector: 'list-li',
5+
selector: 'list-item',
66
templateUrl: 'app/list/item.component.html',
77
styleUrls: ['app/list/item.component.css']
88
})
99

10-
export class ItemComponent implements OnInit {
10+
export class ListItemComponent implements OnInit {
1111
@Input() contact:any = {};
1212
@Output() routerNavigate = new EventEmitter<number>();
1313

src/app/list/list.component.css

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
h3{
2-
height: 35px;
3-
line-height: 35px;
4-
font-size: 16px;
5-
color: #ffffff;
6-
text-align: center;
7-
background-color: #3DD689;
8-
position: relative;
9-
}
10-
h3 i{
11-
position: absolute;
12-
top: 50%;
13-
right: 10px;
14-
width: 25px;
15-
height: 25px;
16-
transform: translateY(-50%);
17-
background: url("./images/add.png") no-repeat;
18-
background-size: cover;
19-
}
201
.list{
212
overflow: auto;
223
position: absolute;

src/app/list/list.component.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
<h3>所有联系人<i (click)="addContact()"></i></h3>
1+
<my-header title="所有联系人" [isShowCreateButton]="true"></my-header>
22
<ul class="list">
33
<li *ngFor="let contact of contacts">
4-
<list-li [contact]="contact" (routerNavigate)="routerNavigate($event)"></list-li>
4+
<list-item [contact]="contact" (routerNavigate)="routerNavigate($event)"></list-item>
55
</li>
66
</ul>
7-
<!-- <my-footer [path]="path" (writeTitle)="writeTitle($event)"></my-footer> -->
87
<my-footer></my-footer>

0 commit comments

Comments
 (0)