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

来自:网络
时间:2023-04-07
阅读:
目录

引言

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>

效果

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

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

发现问题

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

返回顶部
顶部