angular2 自定义标题组件
发布时间:2020-12-17 09:50:50 所属栏目:安全 来源:网络整理
导读:效果: import {Component,Input,OnInit} from "@angular/core";const css = require('./horizontal.component.css');@Component({ selector: 'custom-div-title',templateUrl: './horizontal.component.html',styles: [ css ]})export class CustomDivTitle
效果: import {Component,Input,OnInit} from "@angular/core"; const css = require('./horizontal.component.css'); @Component({ selector: 'custom-div-title',templateUrl: './horizontal.component.html',styles: [ css ] }) export class CustomDivTitleComponent { @Input() title: string = '默认标题'; @Input('title') set changeTitle(val: any) { this.title = val; } } <div class="row custom-div-title"> <div class="col-xs-3"> <span>{{ title }}</span> </div> </div> .custom-div-title { border-top: 5px solid #36a9e1; margin: 10px auto; } .custom-div-title > div { background-color: #36a9e1; color: whitesmoke; font-size: 20px; font-family: "Microsoft YaHei UI"; text-align: left; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |