2
votes

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

1 Answers

1
votes

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
}