vue-vli3.0 introduces element error reporting problem

1.vue-vli3.0引入element报错
Can’t resolve ‘element-ui’
Module not found: Error: Can’t resolve ‘element-ui/lib/button’
Couldn’t parse bundle asset

2. Solved, vue-cli3.0 introduces element-ui according to the document and will report an error because the document has a version specially prepared for vue-cli3.0.
3. Click here
Insert picture description here
4. Follow the instructions on github
Insert picture description here
5. This is for on-demand introduction. Anyway, all of them are introduced
How do you want to import Element? -->Select Import on demand (key)
Choose the locale you want to load-->Select zh-CN

babel.config.js
main.js
src \ plugins \ element.js
App.vue automatically el-button as an example

7. cd src\plugins\element.js modified, take Carousel revolving lantern as an example

import { Carousel, CarouselItem } from ‘element-ui’
Vue.use(Carousel)
Vue.use(CarouselItem)

8. The revolving lantern quoted successfully
Insert picture description here

Guess you like

Origin blog.csdn.net/WQzeus/article/details/109960494