1.点击旋转动画
html:[ngClass]="{'close':aaa,'open':!aaa}"
(click)="aaa=!aaa"
css:.close{transform:rotate(0deg);transition:transform 0.5s;}
ts: aaa=false;
2.点击展开内容
html: (click)="open()"
*ngIf = "isShow"
ts: isShow = false;//先隐藏
open(){this.isShow = !this.isShow;}//点击控制
3.双点击事件
(click) = “open();iClose = !iClose”//直接用;符号隔开
4.选中变色,点击页面其他地方则取消变色
html: [class.selected]="item === selectedItem"
(click) = "onSelect(item)"
ts: item;
selectedItem:any;
onSelect(item:any):void{
this.selectedItem = item;
document.addEventListener(
'click',
function() {
this.selectedItem = null;
}.bind(this),
true
);
}
css: .selected{
color:blue;
}
5.改变angular控件样式(4种可以依次尝试,总有一个有用)
::ng-deep .ant-spin-dot i {
background-color: #4c7bff;
}
:host ::ng-deep .ant-spin-dot i {
background-color: #4c7bff;
}
:root .ant-select-dropdown {
margin-top: 16px;
}
:host /deep/ .ant-spin-dot i {
background-color: #4c7bff;
}