view-design / ViewUIPlus

An enterprise-level UI component library and front-end solution based on Vue.js 3
https://www.iviewui.com
Other
373 stars 128 forks source link

[Bug Report]does not provide an export named 'default' #380

Open 343058360 opened 1 month ago

343058360 commented 1 month ago

Environment

windows11 / chrom127 / vue3

Reproduction link

https://github.com/view-design/view-ui-project-nuxt

Steps to reproduce

pnpm install --shamefully-hoist

What is expected?

正确使用iview-ui-plus

What is actually happening?

无法使用

dosubot[bot] commented 1 month ago

To resolve the import issue with the ViewUIPlus library in your Vue 3 project, you need to ensure that you are importing the library correctly since it does not provide a default export. You should import it as a named import. Here is how you can do it:

import { createApp } from 'vue';
import { createRouter, createWebHistory } from 'vue-router';
import App from './app.vue';
import { install as ViewUIPlus } from 'view-ui-plus'; // Use named import

const router = createRouter({
    esModule: false,
    mode: 'history',
    history: createWebHistory(),
    routes: [
        // your routes here
    ]
});

const app = createApp(App);
app.use(ViewUIPlus); // Use the named import directly
app.use(router);
app.mount('#app');
export default app;

This approach ensures that you are correctly importing and using the ViewUIPlus library in your project. For more details, you can refer to the similar issue here.

To continue talking to Dosu, mention @dosu.