Giter VIP home page Giter VIP logo

Comments (8)

eliyas5044 avatar eliyas5044 commented on May 25, 2024 1

@mgreengithelps acctullay they forgot to add it in plugin for branch master. Please check these two plugin file. Lastet Plugin, Master branch plugin

from vuetify-module.

mgreengithelps avatar mgreengithelps commented on May 25, 2024

Could be wrong, but it should not be available in plugins, per Nuxt Plugin page:

Nuxt.js allows you to define JavaScript plugins to be run before instantiating the root Vue.js Application. This is especially helpful when using your own libraries or external modules.

So if the Vue app is not instantiated yet, then I would suspect you would not be able to access $vuetify within any plugins.

from vuetify-module.

gotenxds avatar gotenxds commented on May 25, 2024

+1 I struggled with this for 5 hours yesterday, thought I was the bug...

from vuetify-module.

kevinmarrec avatar kevinmarrec commented on May 25, 2024

@eliyas5044 Is there any use case to use it in a plugin ? Please let me know, I'll do my best to make it accessible from context in both versions of the module (master / next)

Indeed for now it should be accessible from context only on next version through ctx.app.$vuetify.

from vuetify-module.

eliyas5044 avatar eliyas5044 commented on May 25, 2024

@kevinmarrec sorry for late reply. This is necessary in context menu, if we want to localize vuetify. please check my use case. I used nuxt/i18n for my localization. Now i want to change vuetify local when i18n change.

plugins/i18n.js

export default function({ app }) {
  // onLanguageSwitched called right after a new locale has been set
  app.i18n.onLanguageSwitched = (oldLocale, newLocale) => {
    app.$vuetify.lang.current = newLocale;
  };
}

or

export default function({ $vuetify}) {
  // onLanguageSwitched called right after a new locale has been set
  app.i18n.onLanguageSwitched = (oldLocale, newLocale) => {
    $vuetify.lang.current = newLocale;
  };
}

Thanks

from vuetify-module.

kevinmarrec avatar kevinmarrec commented on May 25, 2024

@eliyas5044 Alright I see, seems common use case, will fix that on both branches and will release new version soon

EDIT: It will be a bit tricky for Vuetify 1.5 as it's the Vuetify plugin that installs $vuetify and not Nuxt itself, but should still be achievable.

EDIT2: Well for 2.0.0-beta.x it seems to be aswell Vuetify that registers $vuetify too, it assumes that app.vuetify (Vue options) is defined (which Nuxt module does).

In both versions, It seems $vuetify is a little different, i'm afraid that we can't really bind it to context correctly

from vuetify-module.

kevinmarrec avatar kevinmarrec commented on May 25, 2024

@eliyas5044 If you're using 1.5, can you try this ?

Create a new plugin that does :

export default (ctx) {
  ctx.$vuetify = Vue.prototype.$vuetify
}

Vue.prototype.$vuetify is set by Vuetify installation (Vue.use(Vuetify))

or you can also even directly try :

export default function({ app }) {
  // onLanguageSwitched called right after a new locale has been set
  app.i18n.onLanguageSwitched = (oldLocale, newLocale) => {
    app.vuetify.lang.current = newLocale;
  };
}

app.$vuetify does not exist but app.vuetify does.

from vuetify-module.

tincho425 avatar tincho425 commented on May 25, 2024

I've tried doing:
app.vuetify.framework.theme.themes.light.primary = obj
or
app.context.$vuetify.theme.themes.light.primary = obj
in /plugins/combined-inject.js. And calling the injected method in asyncData by
context.app.$colorsChangeVuetify({"base":"#FFA000","lighten1":"#6A1B9A"})

In other words: I'm trying to update Vuetify's light theme in asyncData.

But the color is not being updated in the Vuetify theme configuration. What I'm doing wrong? Thanks in advance!

from vuetify-module.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.