【angular5项目积累总结】panel组件
view
code
panel.component.css
:host {
display:flex;
min-width:300px }
panel.component.html
<header class="fxs-blade-header fxs-header fxs-blade-border fxs-trim-border fxs-trim fxs-blade-loaded">
<div class="fxs-blade-title-content">
<div class="fxs-blade-title">
<h2 class="fxs-blade-title-titleText msportalfx-tooltip-overflow" tabindex="-1">
{{headerTitle}}
</h2>
</div>
<div class="fxs-blade-actions" role="menubar" *ngIf="!disableAction">
<button type="button" role="menuitem" class="fxs-blade-collapser fxs-trim-svg fxs-trim-hover" title="Restore" (click)="minmize()" *ngIf="width=='100%'">
<svg height="100%" width="100%" aria-hidden="true" role="presentation" focusable="false">
<g xmlns="http://www.w3.org/2000/svg">
<path d="M 11 5 H 2 v 9 h 9 V 5 Z m -7 7 V 7 h 5 v 5 H 4 Z" />
<path d="M 8 6 V 3 h 5 v 5 h -3 v 2 h 5 V 1 H 6 v 5 h 2 Z" />
</g>
</svg>
</button>
<button type="button" role="menuitem" class="fxs-blade-pin fxs-trim-svg fxs-trim-hover" title="Maximize" (click)="maximize()" *ngIf="width!='100%'">
<svg height="100%" width="100%" role="presentation">
<g xmlns="http://www.w3.org/2000/svg">
<path d="M 1 2 v 12 h 14 V 2 H 1 Z m 2 10 V 6 h 10 v 6 H 3 Z" />
</g>
</svg>
</button>
<button type="button" role="menuitem" class="fxs-blade-close fxs-trim-svg" title="关闭" (click)="close()">
<svg height="100%" width="100%" role="presentation">
<g xmlns="http://www.w3.org/2000/svg">
<path d="M 14 3.3 L 12.7 2 L 8 6.7 L 3.3 2 L 2 3.3 L 6.7 8 L 2 12.7 L 3.3 14 L 8 9.3 l 4.7 4.7 l 1.3 -1.3 L 9.3 8 Z" />
</g>
</svg>
</button>
</div>
</div>
</header>
<div class="fxs-blade-content-container fxs-portal-text" [ngStyle]="{'height.px':height}">
<div class="fxs-blade-content-container-default fxs-blade-border fxs-portal-border fxs-bladecontent fxs-mode-locked fxs-blade-locked fx-rightClick fxs-bladestyle-default fxs-bladesize-small">
<div class="fxs-blade-commandBarContainer" *ngIf="menuItems.length>0">
<div class="fxs-commandBar-target fxs-portal-border fxs-portal-background fxs-portal-svg fxs-commandBar">
<ul class="fxs-commandBar-itemList" role="menubar" style="position: relative;">
<li class="fxs-commandBar-item fxs-portal-border fxs-portal-hover" *ngFor="let item of menuItems" (click)="item.event()" [title]="item.title">
<div class="fxs-commandBar-item-buttoncontainer">
<div class="fxs-commandBar-item-icon">
<svg height="100%" width="100%" role="presentation">
<use xmlns:xlink="http://www.w3.org/1999/xlink" [attr.xlink:href]="item.icon"></use>
</svg>
</div>
<div class="fxs-commandBar-item-text msportalfx-tooltip-overflow" preserveFragment="false">
{{item.title}}
</div>
</div>
</li>
</ul>
</div>
</div>
<ng-content></ng-content>
</div>
</div>
panel.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core'; @Component({
selector: 'panel-component',
templateUrl: './panel.component.html',
styleUrls: ['./panel.component.css'],
host: {
'class': 'fxs-blade fxs-stacklayout-child fxs-blade-maximized fxs-blade-firstblade',
'[class.whatever]': "{'fxs-blade-maximized': width=='100%'}",
'[style.width]': 'width'
}
})
export class PanelComponent { width: string;
height: string; @Input()
initWidth: string; @Input()
headerTitle: string; @Input()
menuItems: Array<{
title: string,
icon: string,
event: string;
}> = []; @Output()
closeEvent: EventEmitter<any> = new EventEmitter(); @Input()
disableAction: boolean = false; constructor() { } ngOnInit() {
var self = this;
this.width = this.initWidth;
this.height = (document.body.clientHeight - 85) + "";
window.addEventListener("resize", function () {
self.height = (document.body.clientHeight - 85) + "";
});
} maximize() {
this.width = "100%";
} minmize() {
this.width = this.initWidth;
} close() {
this.closeEvent.emit();
} }
panel.component.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { PanelComponent } from './panel.component';
@NgModule({
declarations: [
PanelComponent,
],
imports: [
CommonModule,
],
exports: [
PanelComponent
]
})
export class PanelComponentModuleModule {
}
示例:
<div class="fxs-journey-target fxs-journey">
<div class="fxs-journey-layout fxs-stacklayout-horizontal fxs-stacklayout fxs-journey-withspacer">
<panel-component [menuItems]="menuItems" headerTitle="开发者中心" initWidth="600px" (closeEvent)="close()">
</panel-component>
</div>
</div>
import { Component } from '@angular/core';
import { Router } from '@angular/router'; @Component({
selector: 'devCenter-page',
templateUrl: './devCenter.html'
})
export class DevCenterPage {
constructor(private router: Router) { } menuItems: any = [
{ title: "添加", icon: "#FxSymbol0-010", event: null }, ] close() {
this.router.navigate([''], {});
}
}
【angular5项目积累总结】panel组件的更多相关文章
- 【angular5 项目积累总结】项目公共样式
main.css @font-face { font-family: 'wf_segoe-ui_normal'; src: local('Segoe UI'),url('../fonts/segoe- ...
- 【angular5项目积累总结】优秀组件以及应用实例
1.手机端 图片预览组件 组件:sideshow 效果图:(预览图全屏 且可以左右移动) code: <div class="row ui-app-s ...
- 【angular5项目积累总结】avatar组件
View Code import { Component, HostListener, ElementRef } from '@angular/core'; import { Adal4Service ...
- 【angular5项目积累总结】breadcrumb面包屑组件
view code <div class="fxs-breadcrumb-wrapper" aria-label="Navigation history" ...
- 【angular5项目积累总结】遇到的一些问题以及解决办法
1.项目中字符串特别是\r\n,替换成br之后,在页面换行无法生效? 答:绑定元素 innerHTML. <div class="panel-body" [innerHTML ...
- 【angular5项目积累总结】消息订阅服务
code import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; @Injectable ...
- 【angular5项目积累总结】文件上传
<div class="form-group row"> <label class="col-sm-2 col-form-label"> ...
- 【angular5项目积累总结】侧栏菜单 navmenu
View Code import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/co ...
- 【angular5项目积累总结】结合adal4实现http拦截器(token)
import { Injectable } from '@angular/core'; import { HttpEvent, HttpInterceptor, HttpHandler, HttpRe ...
随机推荐
- leetcode 合并两个有序数组
给定两个有序整数数组 nums1 和 nums2,将 nums2 合并到 nums1 中,使得 num1 成为一个有序数组. 说明: - 初始化 nums1 和 nums2 的元素数量分别为 m 和 ...
- ASP.NET MVC 防止CSRF攻击
简介 MVC中的Html.AntiForgeryToken()是用来防止跨站请求伪造(CSRF:Cross-site request forgery)攻击的一个措施,它跟XSS(XSS又叫CSS:Cr ...
- Enabling Remote Errors in SSRS
January 18, 2011 By default the remote errors property in SQL Server Reporting Services is set to fa ...
- CSS文字大小单位PX、EM的区别
◆px像素(Pixel)是相对长度单位,像素px是相对于显示器屏幕分辨率而言的.(引自CSS2.0手册)◆em是相对长度单位,相对于当前对象内文本的字体尺寸.如当前对行内文本的字体尺寸未被人为设置,则 ...
- 论文研读之Spinnaker
论文:Using Paxos to Build a Scalable, Consistent, and Highly Available Datastore Motivation 可扩展性: 随着数据 ...
- 如何进入PageAdmin CMS 安装界面
一般下面几个应用场景如第一次使用PageAdmin配置参数.服务器迁移.主域名更换.忘记超级管理员密码等都可以在安装界面进行设置. 下面为PageAdmin安装步骤 1.地址栏输入:http://您的 ...
- django系列5.1--ORM对数据库的操作
Django---ORM数据库操作(图书管理系统基本实例) 一.基本知识 MVC模式(Model–view–controller)是软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Mo ...
- LOJ#6048. 「雅礼集训 2017 Day10」数列(线段树)
题面 传送门 题解 我的做法似乎非常复杂啊-- 首先最长上升子序列长度就等于把它反过来再接到前面求一遍,比方说把\(2134\)变成\(43122134\),实际上变化之后的求一个最长上升子序列和方案 ...
- 学习xss模拟构造攻击(第一篇)
本文作者:i春秋签约作家——rosectow 0×00前言 XSS又名叫CSS全程(cross site scriptting),中文名跨站脚本攻击,目前网站的常见漏洞之一,它的危害没有像上传漏洞,s ...
- eclipse如何汉化,把eclipse改成中文版
eclipse默认是英文版的,对于中国人来说使用英文语言的软件是件痛苦的事情.下面我来详细说一下如何把eclipse改成中文版的. 工具/原料 eclipse英文版 eclipse中文插件 方法/ ...