我有一个带有Knockout框架的SPFx Web部件 . 它是为SharePoint开发的(V1.1.0) . 部署了SharePoint库中的所有资产 . 应用程序在Chrome中正常运行 . 但在IE中,Web部件未加载到页面中 . 即使我没有任何控制台日志/错误 . 如果我打开开发者控制台打开页面,它就可以了 .

我已经删除了应用程序中的所有控制台日志,即使我已从捆绑的JS中删除了控制台日志 . 仍未加载Web部件 .

然后我认为这可能是加载JS的顺序的问题 . 所以我评论了所有代码和包导入语句 . 但没有运气 .

在一些文章中,我发现它可能是Master页面的问题 . 所以我已经删除了自定义大师并重新定居主人 . 但仍有问题 .

然后,我已经加载了开放式控制台打开的页面,我在控制台中发现了一个问题,

对象不支持属性或方法'警告'

它是从 sp-classic-page-assembly_en-us.js 抛出的 .

另外我有时会看到 sp-classic-page-assembly_en-us.js 的堆栈溢出错误 .

下面是示例ViewModel.ts文件代码 .

import * as ko from 'knockout';
import styles from './Search.module.scss';
import { ISearchWebPartProps } from './SearchWebPart';
import pnp, { SearchResults, Web, SearchResult, SortDirection } from 'sp-pnp-js';
import { QueryBuilder } from './Support/QueryBuilder';
import { SearchParameters } from './Entities/SearchParameters';
import { CommonFunctions } from './Support/CommonFunctions';
import { AppConstants } from './Constants/AppConstants';
import { ListNames } from './Constants/ListNames';
import { DocumentCategory } from './Entities/DocumentCategory';
import { ResultTableProperties } from './Entities/ResultTableProperties';
import { PinnedDocuments } from './Entities/PinnedDocuments';
import { SPComponentLoader } from '@microsoft/sp-loader';
import * as $ from "jquery";
import { Topics } from './Entities/Topics';
import { PinnedLists } from "./Entities/PinnedLists";
import { UserPinnedLists } from "./Entities/UserPinnedLists";
import { ConfigProperties } from "./Entities/ConfigProperties";
import { ConfigKeys } from "./Constants/ConfigKeys";
import 'jqueryui';
require('./es6-promise.auto.min.js');
let Swal: any = require('./sweetalert2.min.js');
let moment: any = require('./MyWIMS-I/js/moment.min.js');

require('./SwalStyles.css');



export interface ISearchBindingContext extends ISearchWebPartProps {
    shouter: KnockoutSubscribable<{}>;
}

export default class SearchViewModel {

    public resultTablePageSize: KnockoutObservable<number> = ko.observable(50);
    public mmsName: KnockoutObservable<string> = ko.observable("");
    public topicsTermID: KnockoutObservable<string> = ko.observable("");
    public startPageNumber: KnockoutObservable<number> = ko.observable(1);
    public lastPageNumber: KnockoutObservable<number> = ko.observable(1);
    public currentPageNumber: KnockoutObservable<number> = ko.observable(1);
    public pinnedDocumentsCount: KnockoutObservable<number> = ko.observable(0);
    public isPrevEnabled: KnockoutObservable<boolean> = ko.observable(false);
    public isNextEnabled: KnockoutObservable<boolean> = ko.observable(false);
    public selectedCategory: KnockoutObservable<string> = ko.observable('');
    public resultTableDocProperties: KnockoutObservableArray<ResultTableProperties> = ko.observableArray([]);
    public rootCategoryDetails: KnockoutObservableArray<DocumentCategory> = ko.observableArray([]);
    public topicsTerms: KnockoutObservableArray<Topics> = ko.observableArray([]);
    public pinnedsectionDetails: KnockoutObservableArray<PinnedLists> = ko.observableArray([]);
    public selectpinListDetails: KnockoutObservableArray<UserPinnedLists> = ko.observableArray([]);
    public associatedLists: KnockoutObservableArray<string> = ko.observableArray([]);
    public docToUnPin: KnockoutObservable<string> = ko.observable('');

    public searchParameters: KnockoutObservable<SearchParameters> = ko.observable(new SearchParameters());
    public openedPinnedList: KnockoutObservable<PinnedLists> = ko.observable(new PinnedLists());
    public isLoading: KnockoutObservable<boolean> = ko.observable(true);
    public isPinnedSectionOpen: KnockoutObservable<boolean> = ko.observable(false);
    public webAbsUrl: string = '';
    public webServRelUrl: string = '';
    public docCategoryDetails: DocumentCategory[] = [];
    private oWeb: Web = undefined;

    constructor(bindings: ISearchBindingContext) {

        this.webAbsUrl = bindings.webAbsUrl;
        this.webServRelUrl = bindings.webServRelUrl;
        this.isLoading(true);
        this.resultTablePageSize(parseInt(bindings.pageSize));
        this.mmsName(bindings.mmsName);
        this.topicsTermID(bindings.topicsTermID);
        this.oWeb = new Web(bindings.webAbsUrl);
        SPComponentLoader.loadScript(this.webAbsUrl + '/_layouts/15/clienttemplates.js', { globalExportsName: 'jQuery' }).then((jQuery: any): void => {
        });

        SPComponentLoader.loadCss(this.webAbsUrl + '/SiteAssets/css/bootstrap.min.css');
        SPComponentLoader.loadCss('https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700');
        SPComponentLoader.loadScript(this.webAbsUrl + '/SiteAssets/js/jquery-2.2.4.min.js', { globalExportsName: 'jQuery' }).then((jQuery: any): void => {
            SPComponentLoader.loadScript(this.webAbsUrl + '/SiteAssets/js/jquery-ui.min.js', { globalExportsName: 'jQuery' }).then((jQuery: any): void => {
                SPComponentLoader.loadScript(this.webAbsUrl + '/SiteAssets/js/bootstrap.min.js', { globalExportsName: 'jQuery' }).then((): void => {
                    SPComponentLoader.loadScript('https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.js', { globalExportsName: 'jQuery' }).then((): void => {
                    });
                });
            });
        });


        this.oWeb.currentUser.get().then((_currentUser: any) => {
            this.currentUserID = _currentUser.Id;
            this.GetUserPinnedLists();
            const sessionKey: string = CommonFunctions.GetQueryStringParameter(AppConstants.CONST_Session_Key);
            const _srchParams: SearchParameters = CommonFunctions.GetSearchParameters(sessionKey);
            this.searchParameters(_srchParams);            
            this.InitiateWIMSSearch();          
        });
    }

    private GetUserPinnedLists(): void {
        this.pinnedListsDetails = [];
        this.oWeb.lists.getByTitle(ListNames.LIST_User_Specific_Pinned_Lists).items.filter("UserNameId eq " + this.currentUserID).orderBy("PinnedListOrder", true).get().then(_pinnedLists => {
            if (_pinnedLists && _pinnedLists.length > 0) {
                for (let i = 0; i < _pinnedLists.length; i++) {
                    this.pinnedListsDetails.push({ ListName: _pinnedLists[i].Title, ListID: _pinnedLists[i].ID, Documents: [], IsExpanded: false, IsSeeMoreVisible: true });
                }
            }
            this.pinnedListsDetails.push({ ListName: AppConstants.CONST_DEFAULT_PinnedList, ListID: 1, Documents: [], IsExpanded: false, IsSeeMoreVisible: true });
        }).catch(e => { this.LogException("GetUserPinnedLists", e); });
    }

    private InitiateWIMSSearch(): void {
        this.GetTopicsTerms();
        this.SearchDocuments(1);        
    }
}

任何的意见都将会有帮助 . 谢谢 .