Javascript swal()。然后(函数())不会在Internet Explorer 11中启动

Javascript swal()。然后(函数())不会在Internet Explorer 11中启动,javascript,internet-explorer,sweetalert2,Javascript,Internet Explorer,Sweetalert2,希望你能帮我,我想我少了一件小事 My\u layout.cshtml包含甜心处理IE的所有相关脚本: (虽然我们已经有一段时间不需要支持IE,但这在以前的版本中仍然有效) vm.是knockout.js绑定的,但我几乎完全确定knockout在这方面没有任何作用。经过多次摸索,我意识到这需要一个polyfill服务 我的IE标签已更新为: @if (Request.Browser.Browser == "IE" || Request.Browser.Browser == "InternetEx

希望你能帮我,我想我少了一件小事

My
\u layout.cshtml
包含甜心处理IE的所有相关脚本:

(虽然我们已经有一段时间不需要支持IE,但这在以前的版本中仍然有效)


vm.
knockout.js
绑定的,但我几乎完全确定knockout在这方面没有任何作用。

经过多次摸索,我意识到这需要一个polyfill服务

我的IE标签已更新为:

@if (Request.Browser.Browser == "IE" || Request.Browser.Browser == "InternetExplorer")
    {
        <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
        <script src="https://npmcdn.com/es6-promise@3.2.1"></script>
    }
@if(Request.Browser.Browser==“IE”| | Request.Browser.Browser==“InternetExplorer”)
{
}

一定会喜欢这一行的

只需添加一个链接到流行的polyfill:
vm.PostCommentData = function (postData, event) {
    var $commentTextBoxId = '#' + vm.createRemedyCommentId;

    if ($($commentTextBoxId).length) {
        var globalTranslations = globalDashboard.GetTranslations();

        swal({
            title: translations.AreYouSureYouWantToSubmit,
            text: '',
            type: 'warning',
            showCancelButton: true,
            confirmButtonText: '<i class="fas fa-thumbs-up"></i> ' + globalTranslations.Yes,
            cancelButtonText: '<i class="fas fa-thumbs-down"></i> ' + globalTranslations.No,
            confirmButtonClass: 'btn btn-success',
            cancelButtonClass: 'btn btn-danger',
            buttonsStyling: false
        }).then(function () {
            vm.state($(event.currentTarget).data('state'));
            var newComment = $($commentTextBoxId).val();
            var errorMessage = $("<ul class='list-unstyled' />");
            var hasErrored = false;

            if (vm.selectedQuestions().length == 0) {
                errorMessage.append("<li>" + translations.AtLeastAQuestionIsRequiredToBeSelected + "</li>");
                hasErrored = true;
            }

            if (vm.selectedDealershipId() == undefined) {
                errorMessage.append("<li>" + translations.PleaseSelectADealership + "</li>");
                hasErrored = true;
            }

            if (newComment === '') {
                errorMessage.append("<li>" + translations.CommentTextIsRequired + "</li>");
                hasErrored = true;
            }

            if (hasErrored) {
                swal({
                    title: translations.Warning,
                    html: errorMessage,
                    type: 'error',
                    buttonsStyling: false,
                    confirmButtonText: '<i class="fas fa-check"></i> ' + globalTranslations.OK,
                    confirmButtonClass: 'btn btn-success'
                });
            }
            else {

                var successMessage = translations.YourRemedyHasBeenSubmitted;
                if (vm.selectedQuestions().length > 1)
                    successMessage = translations.YourRemediesHaveBeenSubmitted;

                swal({
                    title: translations.Completed,
                    text: vm.globalViewModel().decodeEntities(successMessage),
                    type: 'success',
                    buttonsStyling: false,
                    confirmButtonText: '<i class="fas fa-check"></i> ' + globalTranslations.OK,
                    confirmButtonClass: 'btn btn-success'
                }).then(function () {
                    $(remedyBoxId + " .overlay").show();
                    $('#create-remedy-commentFormId').submit();
                });
            }
        });
    }
}
@if (Request.Browser.Browser == "IE" || Request.Browser.Browser == "InternetExplorer")
    {
        <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
        <script src="https://npmcdn.com/es6-promise@3.2.1"></script>
    }