我密切关注了本教程,这是我的组件类
export class AboutComponent implements OnInit {
aboutContent: any;
feedbackBox: any;
feedbackComment = '';
constructor(private store: Store<HomeState>) { }
ngOnInit() {
this.store.pipe(select('home')).subscribe(
d => {
if(d){
this.aboutContent = d.aboutMainContent; //d is still of type 'any'
}
});
}
}
这是化简文件
import { AboutSection } from '../models/about-section';
export interface HomeState{
aboutMainContent: AboutMainSectionState;
}
export interface AboutMainSectionState {
aboutMainContent: AboutSection[]
}
export function reducer(state: HomeState, action): HomeState {
switch (action.type) {
// case 'SUBMIT_FEEDBACK':
// console.log('existing state: ' +JSON.stringify(state));
// console.log('payload: ' + action.payload);
// return {
// ...state,
// feedbackComment: action.payload,
// xwz: ''
// };
default:
return state;
}
}
为什么 d 是 any 类型?我想念什么吗?
感谢您的帮助