- install 'vant' (dependencies)
npm install vant -S
复制代码
- install 'babel-plugin-import' (devDependencies)
npm install babel-plugin-import -D
复制代码
- config babel.config.js (hello-world/babel.config.js)
module.exports = {
presets: ['@vue/app'],
// add begin
plugins: [
[
'import',
{ libraryName: 'vant', libraryDirectory: 'es', style: true },
'vant'
]
]
// add end
};
复制代码
接下来就可以直接在项目中,正确的使用vant了