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 ...
随机推荐
- 一个java内存泄漏的排查案例
这是个比较典型的java内存使用问题,定位过程也比较直接,但对新人还是有点参考价值的,所以就纪录了一下. 下面介绍一下在不了解系统代码的情况下,如何一步步分析和定位到具体代码的排查过程 (以便新人参考 ...
- ScriptManager的使用方法 .(转)
从这一节开始我将和大家一起学习ASP.NET AJAX的服务器端控件的用法.首先,安装ASPAJAXExtSetup.msi,可以到微软官方网站上去下载.安装之后当你新建项目的时候会多出一个ASP.N ...
- Redis 在Golang中使用遇到的坑
1.从lua脚本传回到go那边的数字是string类型 2.hincrby 返回当前值的计算结果(即存放到redis中的值) 3.hset 一个不存在的key,返回什么呢?即设置失败返回什么错误?(会 ...
- ppt基本操作
一.概述及作用 ppt是一种表达用户思想的有力工具,无论是介绍一个计划,介绍一个新的产品,或是员工报告,员工培训,只要事先做一个演示文稿,那么阐述的过程就会变得见面,简明和清晰. 二.界面构成 演示文 ...
- 最优化作业 共轭梯度法 matlab代码
syms f x1 x2 f=(1/2)*x1^2+x2^2; x=[2;1]; a=[1 0;0 2];% A g1=diff(f,x1); g2=diff(f,x2); g=[g1;g2];%导数 ...
- 自动化测试全套流程(一)-搭建Jenkins环境
前提 既然要做自动化测试,那我们就做得彻底一些,将整套系统部署在Linux服务器上,在搭建Jenkins环境之前,我已经通过VirtualBox安装了一个CentOS的服务器,搭建Jenkins是基于 ...
- 给腾讯云Linux主机创建Swap文件
新买的腾讯云主机没有提供Swap分区 理由是由于主机经常因为内存使用率过高,频繁使用Swap,导致磁盘IO过高,服务器整体性能反而下降. 不过用户依然可以使用Swap文件的方式添加Swap. 方法如下 ...
- except but
He didn't speak anything but Greek... 他只会说希腊语.The crew of the ship gave them nothing but bread to ea ...
- angular.js中提供的基础方法
angular.bind angular.callbacks angular.equals /* *Determines if two objects or two values are equiva ...
- Object-C中对“引用(reference)”的理解
http://blog.csdn.net/csz0102/article/details/25984275 注:以下讨论都是在ARC模式下 我们在iOS开发中最经常碰到的“引用(reference)” ...