fix(#I1ETE1): 确认弹窗组件切换页面报错

#Comment
确认弹窗脚本错误

#Issue
close https://gitee.com/LongbowEnterprise/BootstrapBlazor/issues/I1ETE1
This commit is contained in:
Argo-SHCX 2020-04-17 17:04:55 +08:00
parent e3548a82c1
commit 45fdbc62bb
3 changed files with 16 additions and 5 deletions

View File

@ -11,7 +11,10 @@ namespace BootstrapBlazor.Components
/// </summary>
public abstract class PopConfirmButtonBase : ButtonBase
{
private JSInterop<PopConfirmButtonBase>? Interop { get; set; }
/// <summary>
/// 获得/设置 JSInterop 实例
/// </summary>
protected JSInterop<PopConfirmButtonBase>? Interop { get; set; }
/// <summary>
/// 获得/设置 PopoverConfirm 服务实例
@ -149,7 +152,7 @@ namespace BootstrapBlazor.Components
/// <param name="disposing"></param>
protected override void Dispose(bool disposing)
{
if (disposing && Interop != null) Interop.Dispose();
if (disposing) Interop?.Dispose();
base.Dispose(disposing);
}

View File

@ -10,6 +10,9 @@ namespace BootstrapBlazor.Components
{
private Action? Callback { get; set; }
/// <summary>
/// 获得/设置 内部确认弹窗引用
/// </summary>
public (PopoverConfirmOption Option, RenderFragment RenderFragment)? ConfirmBox { get; set; }
/// <summary>

View File

@ -396,9 +396,14 @@
return;
}
$ele.fadeHide(function () {
el.invokeMethodAsync(method);
});
var $pop = $('[data-target="' + id + '"]');
if ($pop.length > 0) {
var href = window.location.href;
$pop.fadeHide(function () {
var _href = window.location.href;
if (href === _href) el.invokeMethodAsync(method);
});
}
});
$('.popover-confirm-container').on('click', 'popover-confirm-buttons .btn', function (e) {