ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.13k stars 14.63k forks source link

组件是否可以单独引用 #5423

Closed lyboy2012 closed 7 years ago

lyboy2012 commented 7 years ago
是否可以在vue组件内单独引用 element-ui的某一个组件,

import { Button as ElButton } from 'element-ui';

export default {
    components: { ElButton },
    template: template
}

而不是在入口 用 全局引用

Vue.component(Button.name, Button)
or
 Vue.use(Button)

目前测试组件内引用webpack 提示: Module not found: Error: Can't resolve 'antd/lib/el-button' , 没搞明白为什么引用el 怎么提示ant 去了

babelrc配置如下

{
    "presets": [
        ["env", { "modules": false }],
        "stage-0"
    ],
    "plugins": ["transform-runtime", [
        "component", [{
            "libraryName": "element-ui",
            "styleLibraryName": "theme-default"
        }]
    ]]
}
element-bot commented 7 years ago

Hello, this issue has been closed because it does not conform to our issue requirements. Please submit issues with issue-generator. More info can be found in #3693.