Vue, Vuetify is not properly initialized

后端 未结 7 1623
旧时难觅i
旧时难觅i 2021-01-31 20:28

I have setup Vuetify on my Vue webpack application.

My project is setup with vue init webpack my-project running Vue 2.5.2

7条回答
  •  不思量自难忘°
    2021-01-31 20:54

    Patrice has one of my preferred finely tailored answers, depending on configuration, this may be what you need:

    webpack | vue 2.5+ | vuetify 2.1+
    

    In your main.js/App.js

    import Vue from 'vue'
    import router from './router'
    import vuetify from './plugins/vuetify' // path to vuetify export
    
    //Vue.component('example-component', require('./components/ExampleComponent.vue').default);
    
    const app = new Vue({
    el: '#app',
    router,
    vuetify,
    });
    

    In your plugins/vuetify.js

    // resources/js/plugins/vuetify.js
    
    import 'material-design-icons-iconfont/dist/material-design-icons.css' // Ensure you are using css-loader
    
    import Vue from 'vue'
    import Vuetify from 'vuetify/lib'
    
    Vue.use(Vuetify)
    
    const opts = {}
    
    export default new Vuetify({
      icons: {
        iconfont: 'md', // default - only for display purposes
      },
    })
    

    In your EaxmpleComponent.vue and all other vue files: Wrap all vue components in v-app and template tag like:

    
    

提交回复
热议问题