您好,将内联 svgs 导入我的 nuxt3 vite 项目时遇到了麻烦。任何建议将不胜感激。
我发现这个有效 但是我需要一个内联项目。所以我会做这样的事情
setup(props) {
const currentIcon = computed(() => {
return defineAsyncComponent(() =>
import(`~/assets/images/icons/push-icon-chatops.svg'?inline`)
);
}).value;
return {
currentIcon,
};
},
但是我发现 vite 的导入方式很奇怪,结果要么是 v-html 中显示的 url 字符串,要么是一个无法读取的对象
我正在尝试使用这个插件,但没有成功。
https://github.com/nuxt-community/svg-module
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号