mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-05 21:50:05 +08:00
!3673 fix(#I65Z0J): can input Enter on textarea element on ValilidateFrom set DisableAutoSubmitFormByEnter to true
* chore: bump version 7.1.9-beta03 * feat: 增加动态脚本 * chore: 增加隔离脚本 validate-form.js * chore: 移除禁用回车脚本准备使用脚本隔离
This commit is contained in:
parent
e303ed5105
commit
521ac4e840
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>7.1.9-beta02</Version>
|
||||
<Version>7.1.9-beta03</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
|
||||
|
@ -1,5 +1,5 @@
|
||||
@namespace BootstrapBlazor.Components
|
||||
@inherits IdComponentBase
|
||||
@inherits BootstrapModuleComponentBase
|
||||
|
||||
@if (Model != null)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@ namespace BootstrapBlazor.Components;
|
||||
/// <summary>
|
||||
/// ValidateForm 组件类
|
||||
/// </summary>
|
||||
[JSModuleAutoLoader("validate-form")]
|
||||
public partial class ValidateForm
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -835,14 +835,6 @@
|
||||
addLink: addLink,
|
||||
removeLink: removeLink
|
||||
};
|
||||
|
||||
$(function () {
|
||||
$(document).on('keydown', 'form', function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
return $(this).attr('data-bb-dissubmit') !== 'true';
|
||||
}
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
(function ($) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -18784,14 +18784,6 @@ return jQuery;
|
||||
addLink: addLink,
|
||||
removeLink: removeLink
|
||||
};
|
||||
|
||||
$(function () {
|
||||
$(document).on('keydown', 'form', function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
return $(this).attr('data-bb-dissubmit') !== 'true';
|
||||
}
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
(function ($) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -235,12 +235,4 @@
|
||||
addLink: addLink,
|
||||
removeLink: removeLink
|
||||
};
|
||||
|
||||
$(function () {
|
||||
$(document).on('keydown', 'form', function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
return $(this).attr('data-bb-dissubmit') !== 'true';
|
||||
}
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
24
src/BootstrapBlazor/wwwroot/modules/validate-form.js
Normal file
24
src/BootstrapBlazor/wwwroot/modules/validate-form.js
Normal file
@ -0,0 +1,24 @@
|
||||
import BlazorComponent from "./base/blazor-component.js"
|
||||
import EventHandler from "./base/event-handler.js"
|
||||
|
||||
export class ValidateForm extends BlazorComponent {
|
||||
_init() {
|
||||
this._setListeners()
|
||||
}
|
||||
|
||||
_setListeners() {
|
||||
EventHandler.on(this._element, 'keydown', e => {
|
||||
if (e.target.nodeName !== 'TEXTAREA') {
|
||||
const dissubmit = this._element.getAttribute('data-bb-dissubmit') === 'true'
|
||||
if (e.keyCode === 13 && dissubmit) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
_dispose() {
|
||||
EventHandler.off(this._element, 'keydown')
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user