vueComponent / ant-design-vue

🌈 An enterprise-class UI components based on Ant Design and Vue. 🐜
https://antdv.com/
Other
20.34k stars 3.8k forks source link

如何在nuxt中按需加载grid组件 #2937

Closed CreateSun closed 3 years ago

CreateSun commented 4 years ago

What problem does this feature solve?

按需加载通过use中间件分别引入了Row与Col,并在nuxt.config.js中引入了对应的css文件,之后在页面中使用a-row与a-col的时候报错。“Unknown custom element:

What does the proposed API look like?

Grid,Row,Col

antd-ui.js

import Row from "ant-design-vue/lib/grid/Row";
import Col from "ant-design-vue/lib/grid/Col";
Vue.use(Col);
Vue.use(Row);

nuxt-config.js

css: [
'~assets/css/main.css',
'ant-design-vue/lib/button/style/css',
'ant-design-vue/lib/message/style/css',
'ant-design-vue/lib/notification/style/css',
'ant-design-vue/lib/icon/style/css',
'ant-design-vue/lib/grid/style/css',
'ant-design-vue/lib/skeleton/style/css',
'ant-design-vue/lib/row/style/css',
'ant-design-vue/lib/col/style/css',
]

index.vue

<template>
    <div>
        <p>主页</p>
        <a-row>
            <a-col>
                <p>Hello World</p>
            </a-col>
        </a-row>
    </div>
</template>
github-actions[bot] commented 3 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.