• vue 使用element-ui


    官方文档

    • 安装
    npm install element-ui -S
    
    • 按需引入
      • 安装babel-plugin-component
          npm install babel-plugin-component
      
      • 将.babelrc修改成

        {
          "presets": [
            ["env", { "modules": false }],
            "stage-3"
          ],
          "plugins": [
            [
              "component",
              {
                "libraryName": "element-ui",
                "styleLibraryName": "theme-chalk"
              }
            ]
          ]
        }
        
      • 按需引用

      import Vue from 'vue';
      import { Button, Select } from 'element-ui';
      import App from './App.vue';
      
      Vue.component(Button.name, Button);
      Vue.component(Select.name, Select);
      /* 或写为
       * Vue.use(Button)
       * Vue.use(Select)
       */
      
      new Vue({
        el: '#app',
        render: h => h(App)
      });
      
    
    
    + 完整的引用列表
    

    import {
    Pagination,
    Dialog,
    Autocomplete,
    Dropdown,
    DropdownMenu,
    DropdownItem,
    Menu,
    Submenu,
    MenuItem,
    MenuItemGroup,
    Input,
    InputNumber,
    Radio,
    RadioGroup,
    RadioButton,
    Checkbox,
    CheckboxButton,
    CheckboxGroup,
    Switch,
    Select,
    Option,
    OptionGroup,
    Button,
    ButtonGroup,
    Table,
    TableColumn,
    DatePicker,
    TimeSelect,
    TimePicker,
    Popover,
    Tooltip,
    Breadcrumb,
    BreadcrumbItem,
    Form,
    FormItem,
    Tabs,
    TabPane,
    Tag,
    Tree,
    Alert,
    Slider,
    Icon,
    Row,
    Col,
    Upload,
    Progress,
    Badge,
    Card,
    Rate,
    Steps,
    Step,
    Carousel,
    CarouselItem,
    Collapse,
    CollapseItem,
    Cascader,
    ColorPicker,
    Transfer,
    Container,
    Header,
    Aside,
    Main,
    Footer,
    Loading,
    MessageBox,
    Message,
    Notification
    } from 'element-ui';

    Vue.use(Pagination);
    Vue.use(Dialog);
    Vue.use(Autocomplete);
    Vue.use(Dropdown);
    Vue.use(DropdownMenu);
    Vue.use(DropdownItem);
    Vue.use(Menu);
    Vue.use(Submenu);
    Vue.use(MenuItem);
    Vue.use(MenuItemGroup);
    Vue.use(Input);
    Vue.use(InputNumber);
    Vue.use(Radio);
    Vue.use(RadioGroup);
    Vue.use(RadioButton);
    Vue.use(Checkbox);
    Vue.use(CheckboxButton);
    Vue.use(CheckboxGroup);
    Vue.use(Switch);
    Vue.use(Select);
    Vue.use(Option);
    Vue.use(OptionGroup);
    Vue.use(Button);
    Vue.use(ButtonGroup);
    Vue.use(Table);
    Vue.use(TableColumn);
    Vue.use(DatePicker);
    Vue.use(TimeSelect);
    Vue.use(TimePicker);
    Vue.use(Popover);
    Vue.use(Tooltip);
    Vue.use(Breadcrumb);
    Vue.use(BreadcrumbItem);
    Vue.use(Form);
    Vue.use(FormItem);
    Vue.use(Tabs);
    Vue.use(TabPane);
    Vue.use(Tag);
    Vue.use(Tree);
    Vue.use(Alert);
    Vue.use(Slider);
    Vue.use(Icon);
    Vue.use(Row);
    Vue.use(Col);
    Vue.use(Upload);
    Vue.use(Progress);
    Vue.use(Badge);
    Vue.use(Card);
    Vue.use(Rate);
    Vue.use(Steps);
    Vue.use(Step);
    Vue.use(Carousel);
    Vue.use(CarouselItem);
    Vue.use(Collapse);
    Vue.use(CollapseItem);
    Vue.use(Cascader);
    Vue.use(ColorPicker);
    Vue.use(Transfer);
    Vue.use(Container);
    Vue.use(Header);
    Vue.use(Aside);
    Vue.use(Main);
    Vue.use(Footer);

    Vue.use(Loading.directive);

    Vue.prototype.$loading = Loading.service;
    Vue.prototype.$msgbox = MessageBox;
    Vue.prototype.$alert = MessageBox.alert;
    Vue.prototype.$confirm = MessageBox.confirm;
    Vue.prototype.$prompt = MessageBox.prompt;
    Vue.prototype.$notify = Notification;
    Vue.prototype.$message = Message;

    
    
    + 其实我还有个跟字体有关的问题
    

    //webpack.config.js里
    {
    test: /.(png|jpg|jpeg|gif|eot|ttf|woff|woff2|svg|svgz)(?.+)?$/,
    use: [{
    loader: 'url-loader',
    options: {
    limit: 10000
    }
    }]
    },

    npm install url-loader --save-dev

  • 相关阅读:
    智课雅思词汇---二十、前缀syn-sym-syl是什么意思
    运行php的时候出现计算机中丢失 MSVCR110.dll怎么解决
    解决PHP5.6版本“No input file specified”的问题
    PhpSpreadsheet如何读取excel文件
    [thinkphp使用phpspreadsheet时出现]Cannot redeclare xxxxxx() (previously declared in C:WWWxxx.xxx:xxx)
    thinkphp中如何使用phpspreadsheet插件
    thinkphp中composer方式安装的插件如何使用
    phpexcel如何读取excel的数据和如何导出数据到excel
    Composer如何安装(安装注意事项)
    enq: TX
  • 原文地址:https://www.cnblogs.com/wulzt/p/10463687.html
Copyright © 2020-2023  润新知