GlobalUIComponentsOption

插入到全局的ui

module.exports = class GlobalUIComponentsOption extends Option {
  async apply(ctx) {
    await ctx.writeTemp(
      `internal/global-ui.js`,
      `export default ${JSON.stringify(this.values, null, 2)}`
    );
  }
};

参考backtotop的实现可以理解的更加透彻

enhanceAppFiles: [
  path.resolve(__dirname, 'enhanceAppFile.js')
],

globalUIComponents: 'BackToTop'

enhanceAppFile.js

import BackToTop from "./BackToTop.vue";

export default ({ Vue }) => {
  Vue.component("BackToTop", BackToTop);
};