vue-cli3 使用mint-ui 按需打包

1. 模块安装
npm i mint-ui -S
npm install babel-plugin-component -D
2. 修改配置babel.config.js
module.exports = {
    
    
  presets: ["@vue/app"],
  plugins:[
    [
      "component",
      {
    
    
        "libraryName": "mint-ui",
        "style": true
      }
    ]
  ]
};
3. 使用

main.js 导入

import {
    
     Button } from 'mint-ui'
Vue.component(Button.name, Button);

组件使用

<mt-button type="danger">danger</mt-button>
<mt-button type="primary">primary</mt-button>

猜你喜欢

转载自blog.csdn.net/gklcsdn/article/details/113812950