当前位置: 首页 > news >正文

泉州做 php 网站域名查找

泉州做 php 网站,域名查找,新网站建设平台,视频网站做app还是h5本文转自#xff1a;https://www.jianshu.com/p/0c566fc1730d 环境#xff1a; Angular 4.0.0 Angular2 Material2 2.0.0-beta.3 node v7.4.0 npm 4.0.5 使用Dialog封装confirmDialog确定框 源代码 来#xff0c;首先来看效果图~ 删除例子确定删除框点击确定后返回值1.定义通…本文转自https://www.jianshu.com/p/0c566fc1730d 环境 Angular 4.0.0 Angular2 Material2 2.0.0-beta.3 node v7.4.0 npm 4.0.5 使用Dialog封装confirmDialog确定框 源代码 来首先来看效果图~ 删除例子 确定删除框 点击确定后返回值 1.定义通用确定框组件 confirmDialog.component.html div classclearfixh1 classpull-left md-dialog-title{{ config.title || 确认操作 }}/h1 span classicon-close-mid pull-right md-dialog-title-close (click)mdDialogRef.close(false)/span /div div md-dialog-content{{ config.content }}/div div md-dialog-actions classconfirm-dialog-operate button md-raised-button colorprimary (click)mdDialogRef.close(true){{ config.button || 确定 }}/button button md-raised-button (click)mdDialogRef.close(false) classconfirm-dialog-cancel取消/button /div 配置项描述config.title可配置默认为“ 确定操作 ”。确定框的标题。config.content需配置。确定框的提示内容。config.button可配置默认为“ 确定 ”。操作按钮的文字。confirmDialog.component.ts import { Component, OnInit, Inject } from angular/core; import { MdDialogRef } from angular/material; import {MD_DIALOG_DATA} from angular/material; Component({ selector: confirm-dialog, styleUrls: [confirmDialog.component.scss], templateUrl: confirmDialog.component.html }) export class ConfirmDialogComponent implements OnInit { config : {}; constructor(private mdDialogRef : MdDialogRefConfirmDialogComponent, Inject(MD_DIALOG_DATA) data: any){ this.config data; } public ngOnInit() { } } confirmDialog.component.scss .md-dialog-title-close:hover{cursor: pointer; } .confirm-dialog-operate{ margin-bottom: 0; margin-top: 15px; align-items: center; justify-content: center; } .confirm-dialog-cancel{ margin-left: 20px; } 2.在app.module.ts引入组件 import { ConfirmDialogComponent } from ./confirmDialog/confirmDialog.component;NgModule({declarations: [ ··· ConfirmDialogComponent, ··· ], entryComponents: [ ··· ConfirmDialogComponent, ··· ] }) export class AppModule { } 3.把组件注入到服务 为了通用把组件注入服务方便在其他地方使用。这样的话就不用在每次使用的时候重新定义组件。 confirmDialog.service.ts import { Component, Inject, Injectable } from angular/core; import { DOCUMENT } from angular/platform-browser; import { MdDialog, MdDialogRef, MdDialogConfig } from angular/material; import { ConfirmDialogComponent } from ./confirmDialog.component; import { Observable } from rxjs/Observable; export class confirmDialogService { constructor( Inject(MdDialog) public _confirmDialog: MdDialog, Inject(DOCUMENT) doc: any) { // 打开dialogbody添加no-scroll样式 _confirmDialog.afterOpen.subscribe((ref: MdDialogRefany) { if (!doc.body.classList.contains(no-scroll)) { doc.body.classList.add(no-scroll); } }); // 关闭dialogbody移除no-scroll样式 _confirmDialog.afterAllClosed.subscribe(() { doc.body.classList.remove(no-scroll); }); } public confirm(contentOrConfig: any, title?: string): Observableany { // 设置dialog的属性宽度高度内容等。 let config new MdDialogConfig(); config { width: 300px, height: 200px }; if (contentOrConfig instanceof Object) { config.data contentOrConfig; } else if ((typeof contentOrConfig) string) { config.data { content: contentOrConfig, title: title } } return this._confirmDialog.open(ConfirmDialogComponent, config).afterClosed(); } } 4.使用例子 在需要使用的组件里的provides注册就可以使用了例子如下 confirmDialog-example.component.ts import { Component, OnInit, ViewEncapsulation, Inject } from angular/core; import { confirmDialogService } from ./confirmDialog.service; Component({ selector: confirmDialog, templateUrl: confirmDialog-example.component.html, providers: [confirmDialogService] }) export class DialogExampleComponent implements OnInit { lastCloseResult: any; public constructor(public _confirmDialogService: confirmDialogService) { } public confirm() { this._confirmDialogService.confirm({ content: 确认删除吗 }).subscribe(res { // 返回结果 if (res) { this.lastCloseResult 删除成功; } else { return; } }); } public ngOnInit() { } } confirmDialog-example.component.html pLast close result: {{lastCloseResult}}/pbutton md-raised-button (click)confirm()删除/button 确定删除后返回结果 this.lastCloseResult 删除成功; 界面即显示删除成功如上面的效果图示。 就这样完成了封装confirmDialog确定框的组件~ 作者LeeChingYin链接https://www.jianshu.com/p/0c566fc1730d來源简书简书著作权归作者所有任何形式的转载都请联系作者获得授权并注明出处。  转载于:https://www.cnblogs.com/freeliver54/p/9741758.html
http://www.pierceye.com/news/501578/

相关文章:

  • 网站开发过程分为哪几个阶段电子商务网站建设毕业设计
  • 网站建设管理风险点广州网站设计智能 乐云践新专家
  • 阿里云增加网站wordpress前台后台都空白
  • 做网站商城要注册什么公司建行官网官网网站吗
  • 国外做meta分析的网站wordpress 下载文件插件
  • 济南城市建设集团网站陕西网
  • 专业的网站设计制作怎么建正规网站
  • 用安卓做网站php网站开发系统
  • 58同城网站建设的不足网站前台代码
  • 网站建设销售人员培训教程长兴县建设局网站
  • 用vue框架做的pc端网站wordpress改造论坛
  • 大庆建设网站首页中国寰球工程有限公司网站设计
  • 免费搭建贴吧系统网站js做网站框架
  • 泰安如何选择网站建设网盘 商业网站建设案例课程 下载
  • 可信赖的邵阳网站建设动漫设计属于什么大类
  • 西安网站排名优化网站设计用什么软件实现
  • 网站注册页面模板html5教程百度云
  • 深圳装饰公司前十强佛山seo优化电话
  • 广东阳春市建设局网站做手机网站的重要性
  • 设置网站的关键词自己做网站有什么用
  • 做那个网站比较好百度百科优化排名
  • 好发信息网站建设新闻今天最新消息
  • 邮件服务器是不是网站服务器河南住房和城乡建设网站
  • 微网站管理平台网站连锁店查询怎么做
  • 网域高科学校网站管理系统企业融资以什么为基础
  • 百度网站改版工具提高网站安全性
  • 科技网站推荐南宁百度seo
  • 设计婚纱网站wordpress主题制作全过程新手必看
  • 郑州网站seo厂家上海制作网页的公司有哪些
  • 网站修改关键词不收录vps 可以做多个网站吗