场景
模拟angular步骤条的时候,有一个场景是这样的,如果步骤条设置了监听事件,则悬浮鼠标样式为pointer,否则为default。
部分代码
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Step } from './steps.interfaces';
@Component({
selector: 'yby-steps',
templateUrl: './steps.component.html',
styleUrls: ['./steps.component.scss']
})
export class YbyStepsComponent implements OnInit {
@Input() steps: Step[] = [];
@Input() current = 1;
@Input() startIndex = 1;
@Output() stepChange: EventEmitter<number> = new EventEmitter();
get hasChangeObserver() {
return this.stepChange.observers.length > 0;
}
constructor() { }
ngOnInit(): void {
}
}
|