diff --git a/scripts/patch-u-input.js b/scripts/patch-u-input.js new file mode 100644 index 0000000..ff54a98 --- /dev/null +++ b/scripts/patch-u-input.js @@ -0,0 +1,27 @@ +/** + * uView u-input 组件补丁 + * 直接用预存的补丁文件覆盖原始文件 + * 使下拉选择框(readonly/disabled)超长文字可自动换行完整显示 + * + * 修改内容详见 scripts/u-input.vue(已修改好的完整文件) + * + * 通过 package.json 的 postinstall 自动执行 + */ +const fs = require('fs'); +const path = require('path'); + +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(target)) { + console.log('[patch-u-input] target not found, skipping'); + process.exit(0); +} + +if (!fs.existsSync(source)) { + console.log('[patch-u-input] source not found, skipping'); + process.exit(0); +} + +fs.copyFileSync(source, target); +console.log('[patch-u-input] Patched successfully');