//1.安装babel-plugin-import
npm install babel-plugin-import --save-dev
//2.在.babel中添加配置
"plugins": [
"transform-vue-jsx",
"transform-runtime",
["import",{"libraryName":"vant","style":true}]
]
3.npm i vant -S 安装vant
//4.在vue组件中的使用
<template>
<van-rate v-model="val"></van-rate>
</template>
<script>
import { Rate } from 'vant'
export default {
components: {
[Rate.name]: Rate
},
data() {
return {
val: 5
}
}
</script>
网友评论