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

ImportSpecifier 中 有local Identifier的时候报错 #33

Open
dcy0701 opened this issue Apr 2, 2018 · 1 comment
Open

ImportSpecifier 中 有local Identifier的时候报错 #33

dcy0701 opened this issue Apr 2, 2018 · 1 comment

Comments

@dcy0701
Copy link

dcy0701 commented Apr 2, 2018

import { Container as ElContainer } from 'element-ui'

这样会报错,这样对于JSX单文件组件或者class-component 很不方便。

需要多写Vue的组件注册(其实完全可以省掉)

Vue.component(Container.name, Container);

或者比如现在的形式,需要在components中alias一下。

import { Container, Main, Button, Header } from 'element-ui'
import template from './app.vue'

@Component({
    name: 'page-app',
    mixins: [template],
    components: {
        ElContainer: Container
    }
})
export default class App extends Vue {

}

或者单文件组件

import { Container, Main, Button, Header } from 'element-ui'
const ElContainer = Container 
@Component({
    name: 'page-app'
})
export default class App extends Vue {
   render () {
       <ElContainer/>
  }
}

极其不方便。

@FlorianWendelborn
Copy link

Seems to be fixed in the original repo by this PR umijs#137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants