3

I would like to convert an existing app made with Vue.js to Quasar framework..

I am scaffolding the Quasar app with 'Quasar init', which creates a blank app. I am migrating the .Vue files from Vuejs to quasar app.

However, the Vuejs app contains 'main.js' at the root of 'src' folder, which I am not sure how to use it in Quasar. I tried to copy the code to 'index.vue' but ended up with errors.

Any idea how to migrate this main.js code to appropriate file in Quasar?

TIA

1 Answer 1

1

Quasar uses App plugins for this.
From https://quasar-framework.org/guide/app-plugins.html

A common use case for Quasar applications is to run code before the root Vue instance is instantiated. Quasar provides an elegant solution to that problem by allowing users to define so-called app plugins.

There are many good examples too:

import axios from 'axios';
    
export default ({ Vue }) => {
  // we add it to Vue prototype
  // so we can reference it in Vue files
  // without the need to import axios
  Vue.prototype.$axios = axios;
    
  // Example: this.$axios will reference Axios now
  //          so you don't need stuff like vue-axios.
  
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.