#vuetify.js #laravel-8 #inertiajs
Вопрос:
Я пытаюсь установить vuetify 3 на Laravel 8 с помощью JetStream инерция. Мне удается успешно установить плагин Vuetify, но я не уверен, как включить плагин в app.js.
Вот мой app.js
require('./bootstrap');
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { InertiaProgress } from '@inertiajs/progress';
import 'vuetify/styles';
import { createVuetify } from 'vuetify';
const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel';
const vuetify = createVuetify();
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) => require(`./Pages/${name}.vue`),
setup({ el, app, props, plugin }) {
return createApp({ render: () => h(app, props) })
.use(plugin)
.mixin({ methods: { route } })
.mount(el);
},
});
InertiaProgress.init({ color: '#4B5563' });
Ответ №1:
import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/inertia-vue3'
import { createVuetify } from 'vuetify'
createInertiaApp({
resolve: name => require(`./Pages/${name}`),
setup({ el, App, props, plugin }) {
const vuetify = createVuetify(...)
createApp({ render: () => h(App, props) })
.use(plugin)
.use(vuetify)
.mount(el)
},
})