exception 异常

exception 异常

异常页用于对页面特定的异常状态进行反馈。通常,它包含对错误状态的阐述,并向用户提供建议或操作,避免用户感到迷失和困惑。

import { ExceptionModule } from '@delon/abc/exception';

代码演示

404 页面。

import { Component } from '@angular/core';@Component({  selector: 'components-exception-404',  template: `  <​exception type="404"><​/exception>`})export class ComponentsException404Component {}

500 页面。

import { Component } from '@angular/core';@Component({  selector: 'components-exception-500',  template: `  <​exception type="500"><​/exception>`})export class ComponentsException500Component {}

403 页面,配合自定义操作。

import { Component } from '@angular/core';@Component({  selector: 'components-exception-403',  template: `  <​exception type="403">    <​button nz-button [nzType]="'primary'">回到首页<​/button>    <​button nz-button>查看详情<​/button>  <​/exception>`})export class ComponentsException403Component {}

API

exception

成员 说明 类型 默认值
[type] 页面类型,若配置,则自带对应类型默认的 title,desc,img,此默认设置可以被 title,desc,img 覆盖 ‘403’,’404’,’500’ -
[title] 标题 string -
[desc] 补充描述 string -
[img] 背景图片地址 string -
ng-content 建议操作,配置此属性时默认的『返回首页』按钮不生效 TemplateRef<​void> -