详解unplugin vue components不能识别组件自动导入类型pnpm

发布时间:2023-03-25 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了详解unplugin vue components不能识别组件自动导入类型pnpm脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

引言

unplugin-vue-components 是一款能帮助组件自动导入的库,简单点的说,你不需要使用import xx From 'xxx.vue' 这行语句也能实现导入的效果。

<script SETUP lang="ts">
import ScreenAdpter from '@compontents/ScreenAdpter/index.vue'
import play from '@components/Play/index.vue'
</script>
<template>
    <ScreenAdpter>
        <Play></Play>
    </ScreenAdpter>
</template>
<style scoPEd></style>

等同于以下效果

<script setup lang="ts">
</script>
<template>
    <ScreenAdpter>
        <Play></Play>
    </ScreenAdpter>
</template>
<style scoped></style>

效果

这里需要实现的效果如下:

发现问题

但是问题来了,使用pnpm的用户,我相信许多人是实现不了这上效果的

脚本宝典总结

以上是脚本宝典为你收集整理的详解unplugin vue components不能识别组件自动导入类型pnpm全部内容,希望文章能够帮你解决详解unplugin vue components不能识别组件自动导入类型pnpm所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。