urldata:any = {};
constructor(private searchservice: SearchService, private route: Router, private activatedroute: ActivatedRoute,
private store: Store<fromRoot.State>, private ref: ChangeDetectorRef, public themeService: ThemeService) {
this.activatedroute.queryParams.subscribe(query => {
if (query['fq']) {
if (query['fq'].includes('png')) {
this.resultDisplay = 'images';
this.urldata.fq = 'url_file_ext_s:(png+OR+jpeg+OR+jpg+OR+gif)';
} else if (query['fq'].includes('avi')) {
this.resultDisplay = 'videos';
} else {
this.resultDisplay = 'all';
}
} else {
this.resultDisplay = 'all';
}
if (query['resultDisplay']) {
this.resultDisplay = query['resultDisplay'];
this.urldata.resultDisplay = this.resultDisplay;
}
this.urldata.start = query['start'] || 0 ;
this.urldata.query = query['query'];
this.urldata.sort = query['sort'];
this.urldata.rows = Number(query['rows']) || 10;
this.message = '';
this.store.dispatch(new queryactions.QueryAction(query['query']));
this.store.dispatch(new queryactions.QueryServerAction(this.urldata));
上面的代码给了我:
未捕获(承诺):TypeError:无法分配对象'#'错误的只读属性'start'。
什么会导致此错误?
我已在我的组件中定义了urldata: any = {}
。