我想在我的Laravel 9 Vuetify 3应用程序中使用@mdi/js
。Vuetify 3 documentation告诉我应该做什么。但这对我不起作用。
我的应用程序. js
import './bootstrap';
import '../css/app.css';
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { InertiaProgress } from '@inertiajs/progress';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m';
const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel';
// Vuetify
import 'vuetify/styles'
import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'
const vuetify = createVuetify({
components,
directives,
})
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
setup({ el, app, props, plugin }) {
return createApp({ render: () => h(app, props) })
.use(plugin)
.use(ZiggyVue, Ziggy)
.use(vuetify)
.mount(el);
},
});
我的模板:
<script setup>
import { mdiAccount } from '@mdi/js'
</script>
<template>
<v-icon :icon="mdiAccount"></v-icon>
</template>
看起来vuetify v-icon
无法处理SVG图形。有人知道如何将@mdi/js
与v-icon
和其他vuetify一起使用吗?
1条答案
按热度按时间vh0rcniy1#
文档指出,您需要向
createVuetify
调用添加一些内容,才能使svg图标工作。将调用修改为: