mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]调整表单初始化 data-form-loaded
This commit is contained in:
parent
2d9b37f52f
commit
ed784c624a
@ -10,7 +10,7 @@
|
|||||||
// | github开源项目:https://github.com/zoujingli/Think.Admin
|
// | github开源项目:https://github.com/zoujingli/Think.Admin
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
define(['zeroclipboard', 'jquery'], function (ZeroClipboard) {
|
define(['jquery'], function () {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* jQuery placeholder, fix for IE6,7,8,9
|
* jQuery placeholder, fix for IE6,7,8,9
|
||||||
@ -283,17 +283,6 @@ define(['zeroclipboard', 'jquery'], function (ZeroClipboard) {
|
|||||||
*/
|
*/
|
||||||
_form.prototype.reInit = function ($container) {
|
_form.prototype.reInit = function ($container) {
|
||||||
$.validate.listen.call(this);
|
$.validate.listen.call(this);
|
||||||
$('[data-copy]').map(function () {
|
|
||||||
var client = new ZeroClipboard(this);
|
|
||||||
client.on("ready", function () {
|
|
||||||
client.on("copy", function (event) {
|
|
||||||
event.clipboardData.setData("text/plain", event.target.getAttribute('data-copy'));
|
|
||||||
});
|
|
||||||
client.on("aftercopy", function () {
|
|
||||||
$.msg.tips('内容复制成功!');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
JPlaceHolder.init();
|
JPlaceHolder.init();
|
||||||
/* 自动给必填字符加上样式 @zoujingli @by 2016-05-11 */
|
/* 自动给必填字符加上样式 @zoujingli @by 2016-05-11 */
|
||||||
$container.find('[required]').parent().prevAll('label').addClass('label-required');
|
$container.find('[required]').parent().prevAll('label').addClass('label-required');
|
||||||
@ -756,7 +745,6 @@ define(['zeroclipboard', 'jquery'], function (ZeroClipboard) {
|
|||||||
* 自动监听规则内表单
|
* 自动监听规则内表单
|
||||||
*/
|
*/
|
||||||
$.validate.listen = function () {
|
$.validate.listen = function () {
|
||||||
|
|
||||||
$('form[data-auto]').map(function () {
|
$('form[data-auto]').map(function () {
|
||||||
if ($(this).attr('data-listen') === 'true') {
|
if ($(this).attr('data-listen') === 'true') {
|
||||||
return;
|
return;
|
||||||
@ -769,19 +757,16 @@ define(['zeroclipboard', 'jquery'], function (ZeroClipboard) {
|
|||||||
this.getAttribute('data-tips') || undefined,
|
this.getAttribute('data-tips') || undefined,
|
||||||
this.getAttribute('data-time') || undefined);
|
this.getAttribute('data-time') || undefined);
|
||||||
});
|
});
|
||||||
});
|
$(this).find('[data-form-loaded]').map(function () {
|
||||||
$('[data-form-loaded]').map(function () {
|
$(this).html(this.getAttribute('data-form-loaded') || this.innerHTML);
|
||||||
$(this).html(this.getAttribute('data-form-loaded') || this.innerHTML);
|
$(this).removeAttr('data-form-loaded').removeClass('layui-disabled');
|
||||||
$(this).removeAttr('data-form-loaded').removeClass('layui-disabled');
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单监听初始化
|
* 表单监听初始化
|
||||||
*/
|
*/
|
||||||
if ($.form && typeof $.form.load === 'function') {
|
|
||||||
$.validate.listen.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $;
|
($.form && typeof $.form.load === 'function') && $.validate.listen.call(this);
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user