SPFx:如何用列表名称填充下拉列表

时间:2019-06-04 12:56:47

标签: sharepoint-online cascadingdropdown spfx

我正在尝试使用SPFx在Webpart的属性面板中创建一个下拉列表,并且找到了本教程:Use cascading dropdowns in web part properties

该示例的问题在于正在使用静态数据,我想知道如何动态获取列表名称。

我该怎么做? 最好的祝福 美国

1 个答案:

答案 0 :(得分:1)

使用pnpjs库,以便您轻松获得列表。

sp.web.lists.get().then((items:any[])=>{
      console.log(items.length);
      //to do, bind to dropdown
    })

enter image description here