Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use vuetify v2.x? #124

Closed
HADB opened this issue Aug 25, 2019 · 4 comments
Closed

How to use vuetify v2.x? #124

HADB opened this issue Aug 25, 2019 · 4 comments

Comments

@HADB
Copy link

HADB commented Aug 25, 2019

As Vuetify 2.0 upgrade guide saying, Vuetify must now be instantiated and passed to the initial Vue instance.

I added option.vuetify = new Vuetify() in buildVueOption of entry.js, but it didn't work but it worked in debug mode when I added vuetify: new Vuetify() in vueRootInstanceOption of main.js.

I can't figure out how to fix this, what's your suggestion?

Thanks!

@David-Desmaisons
Copy link
Member

You should use the install file to add more option for the vue constructor.
This file exposes a vueInstanceOption function that returns all the options that need to be added.
Check for Example:

https://github.com/NeutroniumCore/Neutronium.SPA.Demo/blob/master/Neutronium.SPA.Demo/View/src/install.js
https://github.com/David-Desmaisons/DriveExplorer/blob/master/DriverExplorer.UI/View/src/install.js

@jmecosta
Copy link

jmecosta commented Jan 24, 2021

@David-Desmaisons any hints on how to fix this?

const vueRootInstanceOption = Object.assign({}, vueInstanceOption() || {}, {
  render: h =>
    h(App, {
      props: {
        viewModel: vm.ViewModel,
        __window__: vm.Window
      }
    }),
    vuetify: new Vuetify(opts),
  data: vm
});

=> this works fine with npm run serve
If i run the c# app i get the vuetify is not started.

Neutronium - Browser Log: Message: Error: Vuetify is not properly initialized, see https://vuetifyjs.com/getting-started/quick-start#bootstrapping-the-vuetify-object, source: , line number: 6, page: pack://application:,,,/View/dist/index.html

If i added to entry.js

const opts = {
    theme: {
        dark: true,
    },
};
function buildVueOption(vm) {
    var option = vueInstanceOption(vm);
    option.vuetify = new Vuetify(opts);
  option.render = function(h) {
    const prop = {
      props: {
        viewModel: this.$data.ViewModel,
        __window__: this.$data.Window
      }
    };
    return h(App, prop);
  };
  return option;
}

then no error, however i get nice black page!
image

Any hints how to properly fix this. Would really be great to migrate the vuetify 2.x

@David-Desmaisons
Copy link
Member

David-Desmaisons commented Jan 24, 2021

You add to use the install.js script to add option to the vue instance for both serve and build scenario.
More specifically modify the implementation of the vueInstanceOption function to return vuetify options

function vueInstanceOption(vm) {
//...
  const vuetify = new Vuetify(myOptions);
  return {
      // other stuff...,
      vuetify,
    };
}

Check the https://github.com/David-Desmaisons/Ornette/ repo who is a working example using vuetify.2

In particular: https://github.com/David-Desmaisons/Ornette/blob/master/Ornette/View/src/install.js

@jmecosta
Copy link

ok, excelent. Thanks for the updated sample. Must have checked before!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants