![](/img/trans.png)
[英]how to use azure cognitive search from a sharepoint online SPFx webpart
[英]Trying to hide a div with an Application Customizer in SharePoint Online SPFx
我編寫了一個運行良好的 SPFx 應用程序定制器,我可以使用它登錄到控制台。
但是,當我嘗試在 SPO 中隱藏頁面左上角的“SharePoint”鏈接時,出現以下錯誤
謝謝P
錯誤:無法創建應用程序定制器“ClientSideExtension.ApplicationCustomizer.ab3da44e-81af-4590-9bf3-b305f602265c”。 錯誤信息是'無法設置未定義的屬性(設置'顯示')'。
Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
let message: string = this.properties.testMessage;
if (!message) {
message = '(No properties were provided.)';
}
// Dialog.alert(`Hello from ${strings.Title}:\n\n${message}`).catch(() => {
// /* handle error */
// });
console.log('DefaultApplicationCustomizerApplicationCustomizer onInit...');
console.log('get homeLink');
let homeLink: any = document.getElementsByClassName('o365sx-appName');
console.log('got homeLink');
homeLink.style.display = "none";
console.log('changed homeLink');
getElementsByClassName
返回一個元素列表。 你需要第一個:
let homeLink: any = document.getElementsByClassName('o365sx-appName')[0]
;
您也可以嘗試使用以下代碼:
let homeLink: any = document.getElementById("O365_SuiteBranding_container");
或者
let homeLink: any = document.querySelector("div#O365_SuiteBranding_container");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.