Vue Composition API



  • Is there any way to enable the new composition API? It must be imported before App.vue, such as

    import Vue from 'vue'
    import VueCompositionApi from '@vue/composition-api'
    
    // Register the Composition API plugin BEFORE you import App.vue
    Vue.use(VueCompositionApi)
    
    import App from './App.vue'
    

    Unfortunately, boot files did not work for this because in the generated client-entry.js, they are imported immediately after app.js (and therefore App.vue).



  • Nevermind, found the new starter kit with composition api in discord.



  • Where? Link to the repo please. 🙂

    Scott



  • @s-molinari after upgrading quasar, creating a new project using the CLI with quasar create project-name, gives an option for composition api components.

    And I was wrong in my initial post: you can just enable composition api via boot files.

    Here’s the boot file I’m now using:

    // composition-api.js
    import VueCompositionApi from '@vue/composition-api';
    import { boot } from 'quasar/wrappers';
    
    export default boot(({ Vue }) => {
      Vue.use(VueCompositionApi);
    });
    


  • Ah. I understand now what the deal is, as I personally didn’t realize we offered the composition API plugin as a choice to get installed when TS is selected. Thanks for getting back to us on this with the solution.

    Scott


Log in to reply