[email protected]之使用[email protected]

安装依赖

yarn add babel-plugin-import -D

修改配置文件

//对于使用 babel7 的用户,可以在 babel.config.js 中配置
module.exports = {
    
    
  plugins: [
    ['import', {
    
    
      libraryName: 'vant',
      libraryDirectory: 'es',
      style: true
    }, 'vant']
  ]
};

使用组件

import {
    
    Button} from 'vant';
Vue.use(Button);

// 组件中
<van-button></van-button>

猜你喜欢

转载自blog.csdn.net/qq_36968599/article/details/122299051
今日推荐