简体   繁体   English

如何使用 React Spfx 检查 SP Online 中哪个页面是 aspx 主页

[英]How to check which page is the aspx homepage in SP Online with React Spfx

If I am on a site collection and the homepage isn't "Home.aspx", how can I check which one is it using react SPFX framework?如果我在网站集上并且主页不是“Home.aspx”,我如何使用 React SPFX 框架检查它是哪一个?

You could use pnp library to get the welcome page.您可以使用 pnp 库来获取欢迎页面。

pnp.sp.web.get().then(web=>{
      console.log(web.WelcomPage);
    })

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/use-sp-pnp-js-with-spfx-web-parts https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/use-sp-pnp-js-with-spfx-web-parts

This combination worked for me:这种组合对我有用:

pnp.setup({
  spfxContext: this.props.context
});
let welcomePage = await pnp.sp.web.get().then(web=>{
  return web.WelcomePage;
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM