mirror of
https://github.com/dotnetcore/BootstrapBlazor.git
synced 2025-12-20 02:16:40 +08:00
!1729 fix(#I45VCK): DateTimePicker dynamic support Disabled parameter
* doc: 更新禁用默认值 * doc: 更新文档 * fix: 修复 DateTimePicker 组件开启后再禁用时仍然弹出日期框问题
This commit is contained in:
@@ -99,8 +99,11 @@
|
||||
|
||||
<Block Title="禁用" Introduction="设置 <code>IsDisabled</code> 属性值为 <code>true</code> 时,组件禁止输入">
|
||||
<div class="row g-3">
|
||||
<div class="col-12">
|
||||
<DateTimePicker TValue="DateTime" IsDisabled="true" />
|
||||
<div class="col-12 col-sm-6">
|
||||
<DateTimePicker TValue="DateTime" IsDisabled="IsDisabled" />
|
||||
</div>
|
||||
<div class="col-12 col-sm-6">
|
||||
<Switch @bind-Value="@IsDisabled" />
|
||||
</div>
|
||||
</div>
|
||||
</Block>
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace BootstrapBlazor.Shared.Pages
|
||||
|
||||
private DateTime? BindNullValue { get; set; }
|
||||
|
||||
private bool IsDisabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
toggle: 'datetime-picker',
|
||||
placement: placement
|
||||
})
|
||||
.on('show.bs.popover', function () {
|
||||
var disabled = $(this).parent().hasClass('disabled');
|
||||
return !disabled;
|
||||
})
|
||||
.on('inserted.bs.popover', function () {
|
||||
var pId = this.getAttribute('aria-describedby');
|
||||
if (pId) {
|
||||
|
||||
Reference in New Issue
Block a user