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 }} + + + + + + + + + + + + + + + + + + +