| 123456789101112131415161718 |
- const fs = require('fs');
- const path = 'd:/front-end/hdApp/src/pagesPurchase/order.vue';
- const lines = fs.readFileSync(path, 'utf8').split(/\r?\n/);
- const head = lines.slice(0, 54).join('\n');
- const tail = `
- <block v-else>
- <purchase-ghs-panel ref="ghsPanel" :statusBarHeight="statusBarHeight" />
- </block>
- </view>
- </template>`;
- const scriptIdx = lines.findIndex(l => l.trim() === '<script>');
- const rest = lines.slice(scriptIdx).join('\n');
- const out = head + tail + '\n' + rest;
- fs.writeFileSync(path, out);
- console.log('fixed template');
|