From 255bcb8cc9dcc0d98c08af3d7c16a5fd79aea75e Mon Sep 17 00:00:00 2001 From: zhangyutong Date: Thu, 15 Jun 2023 13:17:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD=20?= =?UTF-8?q?=E6=9C=89=E5=80=BC=E6=97=B6=E6=89=8D=E8=A6=86=E7=9B=96placehold?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/form.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/form.js b/src/modules/form.js index 792536d9..3a0e196f 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -315,9 +315,11 @@ layui.define(['lay', 'layer', 'util'], function(exports){ } // 删除input已有文本并放入 placeholder,方便输入 - input.attr('placeholder', input.val()); - input.val(''); // 清空输入框的值 - + if (input.val()) { + // 有值时才删除并替换placeholder + input.attr('placeholder', input.val()); + input.val(''); // 清空输入框的值 + } followScroll(); }