init commit

This commit is contained in:
zhouyuejun
2018-10-26 11:33:25 +08:00
commit bec3bb9137
106 changed files with 29628 additions and 0 deletions
@@ -0,0 +1,9 @@
<ul class="bar-menu" [hidden]="!data.isExpend" *ngIf="!isLeaf(data)">
<li *ngFor="let item of data.children">
<a (click)="itemClicked(item);">
<i class="fa mr-3" [ngClass]="item.icon"></i> <span>{{item.name}}</span>
<i style="margin-top:3px;width:17px" class="fa pull-right" [ngClass]="{'fa-angle-down': !isLeaf(item) && item.isExpend, 'fa-angle-left': !isLeaf(item) && !item.isExpend}"></i>
</a>
<app-bar-menu [data]="item"></app-bar-menu>
</li>
</ul>
@@ -0,0 +1,58 @@
@import "../../theme/scss/variables.scss";
.bar-menu {
list-style: none;
font-size: 16px;
padding: 0;
margin: 0;
a {
color: $color-gray-deep;
text-decoration: none;
border: 0px;
}
& > li {
position: relative;
margin: 0;
// padding: 0 10px;
background: rgb(46, 59, 76);
border-top: 2px solid rgb(34, 49, 68);
// box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.03);
&:hover {
& > a {
color: $color-gray-deep;
border: 0px;
}
}
&.active {
& > a {
color: $color-gray-deep;
border: 0px;
}
}
& > a {
padding: 8px 5px 8px 60px;
display: block;
border-left: 3px solid transparent;
color: $color-gray-deep;
border: 0px;
&:hover {
color: $color-white;
-webkit-transition: 0.3s;
transition: 0.3s;
-moz-transition: 0.3s;
-webkit-transition: 0.3s;
-o-transition: 0.3s;
cursor: pointer;
filter: alpha(opacity=35);
-moz-opacity: 0.35;
opacity: 0.35;
margin-left: 5px;
}
& > .fa {
&::before {
width: 25px;
}
}
}
}
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { BarMenuComponent } from './bar-menu.component';
describe('BarMenuComponent', () => {
let component: BarMenuComponent;
let fixture: ComponentFixture<BarMenuComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ BarMenuComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(BarMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,34 @@
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-bar-menu',
templateUrl: './bar-menu.component.html',
styleUrls: ['./bar-menu.component.scss']
})
export class BarMenuComponent implements OnInit {
@Input() data: Array<any>;
constructor() { }
ngOnInit() {
}
/**
* 判断是否有子节点
* @param item
*/
isLeaf(item: any) {
return !item.children || !item.children.length;
}
/**
* 菜单点击事件
* @param item
*/
itemClicked(item: any) {
if (!this.isLeaf(item)) {
item.isExpend = !item.isExpend;
}
}
}
@@ -0,0 +1,13 @@
import { BarMenuModule } from './bar-menu.module';
describe('BarMenuModule', () => {
let barMenuModule: BarMenuModule;
beforeEach(() => {
barMenuModule = new BarMenuModule();
});
it('should create an instance', () => {
expect(barMenuModule).toBeTruthy();
});
});
@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { BarMenuComponent } from './bar-menu.component';
@NgModule({
imports: [
CommonModule
],
declarations: [BarMenuComponent],
exports: [BarMenuComponent]
})
export class BarMenuModule { }