From c75048086bf817ae7874a05c37d6daed05317461 Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Sun, 28 Jun 2026 13:47:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/patch-u-input.js | 128 +---------- scripts/u-input.vue | 447 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 458 insertions(+), 117 deletions(-) create mode 100644 scripts/u-input.vue diff --git a/scripts/patch-u-input.js b/scripts/patch-u-input.js index 40620ef..c0c690d 100644 --- a/scripts/patch-u-input.js +++ b/scripts/patch-u-input.js @@ -1,129 +1,23 @@ /** * uView u-input 组件补丁 - * 在 isSelectLike(readonly/disabled)模式下用 view 代替原生 input 显示文字 - * 使下拉选择框超长文字可以自动换行完整显示 - * - * 通过 package.json 的 postinstall 自动执行 + * 直接用预存的补丁文件覆盖原始文件 + * 使下拉选择框(readonly/disabled)超长文字可自动换行完整显示 */ const fs = require('fs'); const path = require('path'); -const filePath = path.join('node_modules', 'uview-plus', 'components', 'u-input', 'u-input.vue'); +const target = path.join('node_modules', 'uview-plus', 'components', 'u-input', 'u-input.vue'); +const source = path.join('scripts', 'u-input.vue'); -if (!fs.existsSync(filePath)) { - console.log('[patch-u-input] u-input.vue not found, skipping'); +if (!fs.existsSync(target)) { + console.log('[patch-u-input] target not found, skipping'); process.exit(0); } -let content = fs.readFileSync(filePath, 'utf8'); -let patched = false; - -// === 补丁1:模板中添加 v-if/v-else === -if (!content.includes('u-input__content__field-wrapper__field--selectlike')) { - const oldTemplate = ` - - {{ innerValue }} - {{ placeholder }} - - - + + + + + + + + + + + + {{ innerValue }} + {{ placeholder }} + + + + + + + + + + + + + + + + + + +