zoukankan      html  css  js  c++  java
  • xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

    element-ui & babel-plugin-component config bug

    vue-cli

    bad ❌

    babel.config.js

    module.exports = {
      presets: [
        '@vue/cli-plugin-babel/preset',
        [
          "es2015",
          {
            "modules": false,
          },
        ],
      ],
      "plugins": [
        [
          "component",
          {
            "libraryName": "element-ui",
            "styleLibraryName": "theme-chalk",
          },
        ],
      ],
    };
    
    

    good ✅

    babel.config.js

    module.exports = {
      presets: [
        '@vue/cli-plugin-babel/preset',
      ],
      "plugins": [
        [
          "component",
          {
            "libraryName": "element-ui",
            "styleLibraryName": "theme-chalk",
          },
        ],
      ],
    };
    
    
    

    main.js

    
    import Vue from 'vue';
    import App from './App.vue';
    import router from './router';
    import store from './store';
    
    // import ElementUI from 'element-ui';
    // import 'element-ui/lib/theme-chalk/index.css';
    // Vue.use(ElementUI);
    
    import { Button, Select } from 'element-ui';
    // Vue.component(Button.name, Button);
    // Vue.component(Select.name, Select);
    /* OR */
    Vue.use(Button);
    Vue.use(Select);
    
    
    
    Vue.config.productionTip = false;
    
    new Vue({
      router,
      store,
      render: h => h(App),
    }).$mount('#app');
    
    

    https://element.eleme.io/#/en-US/component/quickstart#on-demand

    refs



    ©xgqfrms 2012-2020

    www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


  • 相关阅读:
    Java基本元素
    wsgiref模块
    Web框架与HTTP协议
    pymysql 于pycharm中操作mysql
    mysql
    协程
    jQuery选择器
    网络编程→锁/队列/线程
    初识网络编程&并发编程
    navcat 如何将一个库的表抽到另一个库中
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/14061169.html
Copyright © 2011-2022 走看看