Angular 弹窗 控件
这个控件个人很喜欢,比起primgNG等弹窗组建,这款弹窗可以很轻松的定义自己的样式和布局。
可控参数有:宽度,高度,是否带有关闭图标,基本满足基础弹窗需求。
并且 Title/Content/Footer可以不强制三者并存。

调用组件方法如下:
<popup-common *ngIf="showPupup" [width]="600" [height]="300" [closebtn]="true" (popupData)="closePopupFn($event)">
<div class="popup-title">Title</div>
<div class="popup-content">
This is the content.
</div>
<div class="popup-footer">
This is the footer.
</div>
</popup-common>
弹窗组件:
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component ({
selector: 'popup-common',
template: `<div class="popup-mask">
<div class="popup-maskBox">
<div class="popup-maskContentBox" [ngStyle]="getStyle()">
<ng-content select=".popup-title"></ng-content>
<ng-content select=".popup-content"></ng-content>
<ng-content select=".popup-footer"></ng-content>
<span class="fa fa-close close-icon" *ngIf="closebtn" (click)="closePopupFn()"></span>
</div>
</div>
</div>
`,
styles: [`
.popup-maskContentBox {
position: relative;
}
.close-icon {
position: absolute;
right: -15px;
top: -15px;
color: #fff;
background: rgba(0,0,0,.5);
border-radius: 50%;
font-size: 12px;
width: 30px;
height: 30px;
text-align: center;
line-height: 30px;
}
.close-icon:hover {
cursor: pointer;
}
`]
})
export class PopupCommonComponent implements OnInit {
@Input() width: number;
@Input() height: number;
@Input() showPopup: boolean;
@Input() closebtn: boolean = true;
@Output() popupData = new EventEmitter();
ngOnInit(){
this.width = this.width != undefined ? this.width : 500;
}
getStyle(){
return { width: this.width + 'px', height: this.height + 'px' }
}
closePopupFn(){
this.showPopup = false;
this.popupData.emit(this.showPopup);
}
}
Angular 弹窗 控件的更多相关文章
- 多功能弹窗控件layer
开发网站的时候,如何合理运用好各种插件对开发的帮助是很大的. 免去了我们调试各种交互效果, 比如常用的弹窗.气泡.提示.加载.焦点.标签.导航.折叠等等 这里会推荐几个常用的js插件,丰富多样简单易移 ...
- jquery.sobox 经典版弹窗控件
sobox 是一款非常实用的,基于 jQuery 的弹窗控件.功能非常完整,而代码量又非常少(压缩完仅8k不到)的一款弹窗控件,如果你熟悉ext的弹窗控件,那么sobox的使用对你来说应该是愉悦而完全 ...
- Kendo UI for Angular 2 控件
Kendo UI for Angular 2 控件 伴随着 Angular 2 的正式 release,Kendo UI for Angular 2 的第一批控件已经发布了,当前是 Beta 版本,免 ...
- (转载)Android UI设计之AlertDialog弹窗控件
Android UI设计之AlertDialog弹窗控件 作者:qq_27630169 字体:[增加 减小] 类型:转载 时间:2016-08-18我要评论 这篇文章主要为大家详细介绍了Android ...
- 集成 Kendo UI for Angular 2 控件
伴随着 Angular 2 的正式 release,Kendo UI for Angular 2 的第一批控件已经发布了,当前是 Beta 版本,免费使用. 官方站点:Kendo UI for Ang ...
- 玩转控件:重写/重绘Dev中MessageBox弹窗控件
很久没有更新博客了,本想着直接发一篇<手撕ERP>系列,从控件重写.重绘,到框架搭建,再到部分模块实现+业务的.但是每次动手的时候,都觉得难以下手.直接从数据库设计开始吧,模块设计还没定下 ...
- Jbox弹窗控件无法获取子页面元素值得问题
top.$.jBox.open("iframe:${ctx}/report/reportSubjectDatabase/toChildWindow", "请选择重构快照表 ...
- [iOS基础控件 - 6.11.3] 私人通讯录Demo 控制器的数据传递、存储
A.需求 1.搭建一个"私人通讯录"Demo 2.模拟登陆界面 账号 密码 记住密码开关 自动登陆开关 登陆按钮 3.退出注销 4.增删改查 5.恢复数据(取消修改) 这个代码 ...
- angular+bootstrap+MVC 之三,分页控件初级版
今天实现一个分页控件,效果如下: 1.HTML: <!doctype html> <!--suppress ALL --> <html ng-app="appT ...
随机推荐
- MySQL中有关char、varchar、int、tinyint、decimal
char.varchar属于字符串类型 1.char属于定长,能确切的知道列值的长度,也就是有多少个字符.当指定char(5)时,表示只能存5个字符,如5个英文‘a’,5个汉字‘我’,5个符号‘&am ...
- 基于bootstrap模态框的alert弹窗
完成的效果如下: html代码: <!-- 弹出框 --> <div class="modal fade" id="alert_like" t ...
- 如何提高Ajax性能
1.适当使用缓存机制 2.使用CDN内容分发来访问Jquery脚本: (1)自己公司架设CDN服务器 (2)使用第三方公司的,比如微软,谷歌等公司的CDN,但有时候不太靠谱 3.JS/CSS文件的打包 ...
- 如何递归执行view的动画
如何递归执行view的动画 效果: 山寨的源头: 图片素材: 源码: // // ViewController.m // RepeatAnimationView // // Created by Yo ...
- 使用NPOI 2.1.1读取EXCEL2003/2007返回DataTable
winform中打开excel的筛选器设置为:openFileDialog.Filter = "Excel 文件(*.xls)|*.xls;*.xlsx"; 一,不借助插件读取Ex ...
- metasploit 渗透测试笔记(基础篇)
0x00 背景 笔记在kali linux(32bit)环境下完成,涵盖了笔者对于metasploit 框架的认识.理解.学习. 这篇为基础篇,并没有太多技巧性的东西,但还是请大家认真看啦. 如果在阅 ...
- MySQL忘记密码处理方法
在windows下: 打开命令行窗口,停止mysql服务: Net stop mysql 在cmd下启动mysql,一般到mysql的安装路径,找到 mysqld-nt.exe 执行:m ...
- JavaScript的DOM_通过元素的class属性操作样式
使用 style 属性可以设置行内的 CSS 样式,而通过 id 和 class 调用是最常用的方法. <script type="text/javascript"> ...
- Codeforces441A_Valera and Antique Items(水题)
Valera and Antique Items time limit per test 1 second memory limit per test 256 megabytes input stan ...
- 当网页失去焦点时改变网页的title值
<script> document.addEventListener('visibilitychange', function() { var isHidden = document.hi ...