首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >spfx - onpropertychange事件

spfx - onpropertychange事件
EN

Stack Overflow用户
提问于 2019-02-12 00:21:17
回答 1查看 300关注 0票数 0

我已经创建了级联下拉菜单。我需要加载基于父级下拉选择的下拉列表。我正在尝试使用onpropertychange事件。但我在super.onpropertychange上遇到错误,说{类型‘BaseClientSideWebPart’上不存在属性'onPropertyChange‘。}

请让我们知道我错过了什么。

代码语言:javascript
复制
 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);  
    }  
  }  

EN

回答 1

Stack Overflow用户

发布于 2019-02-12 23:14:04

也许您指的是来自BaseWebPart类的onPropertyFieldChanged,而不是onPropertyChange

错误消息是准确的- web部件没有名为onPropertyChange的方法。上面的内容听起来最符合你想要做的事情。注意,它需要的不是两个参数,而是三个:propertyPatholdValuenewValue

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54634798

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档