我已经创建了级联下拉菜单。我需要加载基于父级下拉选择的下拉列表。我正在尝试使用onpropertychange事件。但我在super.onpropertychange上遇到错误,说{类型‘BaseClientSideWebPart’上不存在属性'onPropertyChange‘。}
请让我们知道我错过了什么。
protected onPropertyChange(propertyPath: string, newValue: any):void{
if(propertyPath === "listDropDown"){
// Change only when drop down changes
super.onPropertyChange(propertyPath,newValue);
// Clears the existing data
this.properties.ItemsDropDown = undefined;
this.onPropertyChange('ItemsDropDown', this.properties.ItemsDropDown);
// Get/Load new items data
this.GetItems();
}
else {
// Render the property field
super.onPropertyChange(propertyPath, newValue);
}
}
发布于 2019-02-12 23:14:04
也许您指的是来自BaseWebPart类的onPropertyFieldChanged,而不是onPropertyChange?
错误消息是准确的- web部件没有名为onPropertyChange的方法。上面的内容听起来最符合你想要做的事情。注意,它需要的不是两个参数,而是三个:propertyPath、oldValue和newValue。
https://stackoverflow.com/questions/54634798
复制相似问题