一个通知模块
需要在全局style.css中加上@import "angular-notifier/styles";
再在component中引入
private readonly notifier: NotifierService;
constructor(
notifierService: NotifierService
) {
this.notifier = notifierService;
}
还需要在全局引入
<router-outlet>
<notifier-container></notifier-container>
</router-outlet>
import {NotifierModule, NotifierOptions} from "angular-notifier";
const customNotifierOptions: NotifierOptions = {
position: {
horizontal: {
position: 'left',
distance: 12
},
vertical: {
position: 'bottom',
distance: 12,
gap: 10
}
},
theme: 'material',
behaviour: {
autoHide: 5000,
onClick: 'hide',
onMouseover: 'pauseAutoHide',
showDismissButton: true,
stacking: 4
},
animations: {
enabled: true,
show: {
preset: 'slide',
speed: 300,
easing: 'ease'
},
hide: {
preset: 'fade',
speed: 300,
easing: 'ease',
offset: 50
},
shift: {
speed: 300,
easing: 'ease'
},
overlap: 150
}
};
@NgModule({
imports: [
NotifierModule.withConfig(customNotifierOptions) // 通知功能
]
})
更多内容在StackBlitz