mintui使用

2021-07-01  本文已影响0人  JX灬君

1.安装
yarn add mint-ui

2.样式引入进来(完全引入)

// 引入mintui样式
import MintUI from "mint-ui";
import "mint-ui/lib/style.css";
Vue.use(MintUI);

3.样式引入进来(按需加载)

// add babel-plugin-component 依赖
yarn add -D babel-plugin-component
新建 .babelrc
{
  "presets": [
    ["env", { "modules": false }]
  ],
  "plugins": [["component", [
    {
      "libraryName": "mint-ui",
      "style": true
    }
  ]]]
}

如果报错 Error: .plugins[0][1] must be an object, false, or undefined
处理办法 修改.babelrc文件
{
  "presets": [
    ["env", { "modules": false }]
  ],
  "plugins": [
    ["component", 
      {
      "libraryName": "mint-ui",
      "style": true
      }
    ]
  ]
}

4.使用

// 以Indicator为例
// 在vue页面引入
import { Indicator } from 'mint-ui';
// 在methods方法里调用
// 启用
Indicator.open('加载中...');
// 关闭
Indicator.();
上一篇 下一篇

猜你喜欢

热点阅读