From a5163732af43abd732ec4ccedcbda202f06d522c Mon Sep 17 00:00:00 2001 From: Karson Date: Mon, 5 Jul 2021 11:28:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=99=84=E4=BB=B6=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=8C=89=E9=92=AE=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/js/require-form.js | 33 +++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/public/assets/js/require-form.js b/public/assets/js/require-form.js index d4119177..6b85c218 100755 --- a/public/assets/js/require-form.js +++ b/public/assets/js/require-form.js @@ -242,7 +242,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio faselect: function (form) { //绑定fachoose选择附件事件 if ($(".faselect,.fachoose", form).size() > 0) { - $(".faselect,.fachoose", form).on('click', function () { + $(".faselect,.fachoose", form).off('click').on('click', function () { var that = this; var multiple = $(this).data("multiple") ? $(this).data("multiple") : false; var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : ''; @@ -413,6 +413,35 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio return false; }); }, + tagsinput: function (form) { + //标签输入 + $("input[data-toggle='tagsinput']").each(function () { + var setting = { + width: 'auto', + defaultText: '输入后空格确认', + minInputWidth: 110, + height: '36px', + placeholderColor: '#999', + onChange: function (row) { + $("input", $(this).next()).parent().focus(); + $("input", $(this).next()).trigger("blur.autocomplete").focus(); + }, + }; + var autocomplete = $(this).data("tagsinput-autocomplete"); + if (autocomplete) { + if (typeof autocomplete == 'string') { + autocomplete = {url: autocomplete}; + } + setting['autocomplete'] = $.extend({ + url: '', + minChars: 1, + menuClass: 'autocomplete-tags' + }, autocomplete); + } + setting = $.extend(true, setting, $(this).data("tagsinput") || {}); + $(this).tagsInput(setting); + }); + }, bindevent: function (form) { }, @@ -531,6 +560,8 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio events.slider(form); events.switcher(form); + + events.tagsinput(form); }, custom: {} },