As I work on developing my app with Nuxt, I find myself frustrated by the need to constantly write an if statement in my pages using this.$Vuetify.breakpoint.name == 'xs' for handling responsiveness. Instead, I want to create my own variable for easier access. Below is the code snippet:
(mynuxtapp/plugins/createCustomVar.js)
import Vue from "vue";
Vue.prototype.$bp = Vue.prototype.$vuetify.breakpoint.name;
console.log(Vue.prototype.$bp);
I have ensured that the plugin runs in my nuxtconfig file, but unfortunately, it returns an error: TypeError: Cannot read property 'breakpoint' of undefined. It seems like I am unable to access Vuetify using "$", even though I can do so in my pages.
What steps should I take next? Are there any simpler methods or best practices that I should consider? Thank you for taking the time to read through my question!