Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When importing the component on demand, the default componentPrefix does not work. #39

Closed
1 task done
WJCHumble opened this issue Oct 29, 2021 · 4 comments
Closed
1 task done
Assignees
Labels
type: question Further information is requested

Comments

@WJCHumble
Copy link

WJCHumble commented Oct 29, 2021

Basic Info

额外补充

I found that the name of the fully imported component used componentPrefix + Component.name, but the name of the demand imported component only used export name.

预期结果

It can use <a-button> in <template>.

复现步骤

  1. Create a vue3 + vite project.
  2. Add vite-plugin-import plugin to imports component's style on demand.
  3. Import component in <script setup>, such as import { Button } from "@arco-design/web-vue", and then can't use <a-button> in <template>.
@flsion
Copy link
Member

flsion commented Nov 1, 2021

You need to register the ArcoVue component library in the app before you can use the usage of <a-button> in the template.
https://arco.design/vue/docs/start

@WJCHumble
Copy link
Author

@flsion I mean the name of the export component need a default prefix. In this way, it can distinguish the user component and library component when I imported component on demand.

@flsion
Copy link
Member

flsion commented Nov 3, 2021

@WJCHumble In order to be more versatile, the exported variable of the component will not be prefixed by default, if want to add a prefix, you can use import as to rename the component name.

<script setup>
import { Button as AButton } from "@arco-design/web-vue"
</script>

<template>
    <AButton type="primary">Primary</AButton>
</template>

@WJCHumble
Copy link
Author

WJCHumble commented Nov 3, 2021

@flsion well, I know it can use import as to rename the component name, but I think it is too troublesome. Thank you for your answer.

@flsion flsion added the type: question Further information is requested label Nov 4, 2021
@flsion flsion self-assigned this Nov 5, 2021
@flsion flsion closed this as completed Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants