fix-order-template.js 558 B

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