pages.module也要引入antd的module,要不,报错
我使用的angular7.x,所以我用antd的7.x版本;用8.x有问题的。
菜单默认进来选中,需要一个类:
ant-menu-item-selected // 在li上直接加上这个类就可以了
==>或者使用routerLink(html的路由跳转)
引用公共组件的时候,需要依赖Nga.module,否则报错。
'app-ba-menu' is not a known element:
1. If 'app-ba-menu' is an Angular component, then verify that it is part of this module.
2. If 'app-ba-menu' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
- ReactiveFormsModule的报错:
ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'formGroup' since it isn't a known property of 'form'. ("<div class="device-list-container">
<form nz-form [ERROR ->][formGroup]="validateForm" class="ant-advanced-search-form">
<div nz-row [nzGutter]="24">
- baseService的问题
baseService中constructor的内容,其他service也要有,要不然报错!
export class AuthService extends BaseServiceService {
constructor(http: HttpClient,
router: Router) {
super(http, router);
}
// 用户信息接口
getUserInfo(data) {
return this.jsonCall(data, '/xxxxxx/api/user/get-user-info', 'get');
}
}
- base64
import '../widget/script/base64.js';
declare var Base64: any;
其他问题:
登录接口,点击的时候,loading,成功后取消loading状态;
ba-page-top组件抽离:logout和折叠函数。
路由跳转方式:
接口获取:
// 角色信息
getRoleInfo() {
const params = {observe: ‘response’};
/* this.http.get(’/developer-center/api/role-param/find-all-role’, params).subscribe(res => {
console.log(‘角色信息res:’, res);
});*/
this.getHttp().subscribe(res => {
console.log(‘res:’, res);
console.log(‘headers:’, res.headers);
console.log('headers-xtotal:', res.headers.get('x-total-count'));
console.log('body:', res.body);
});
}
getHttp(): Observable {
return this.http.get(’/developer-center/api/role-param/find-all-role’, {observe: ‘response’});
}
==>请求头的问题和响应头的问题,所以我们要封装一个baseService了。要做的!
session和local保存信息的问题。
routerLinkActive的问题
菜单一进来就选中的可以使用的:
[routerLink]="[item2.path]" routerLinkActive=‘active’
.ant-menu-item.active{
background: #1890ff;
}
ok;菜单基本完成了!
500走catch里面;且没有头信息;