/**
* uView u-input 组件补丁
* 在 isSelectLike(readonly/disabled)模式下用 view 代替原生 input 显示文字
* 使下拉选择框超长文字可以自动换行完整显示
*
* 通过 package.json 的 postinstall 自动执行
*/
const fs = require('fs');
const path = require('path');
const filePath = path.join('node_modules', 'uview-plus', 'components', 'u-input', 'u-input.vue');
if (!fs.existsSync(filePath)) {
console.log('[patch-u-input] u-input.vue 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 }}