💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 安装 从 yarn 或 npm 安装并引入 ant-design-vue `npm add ant-design-vue` ## 引入vue **完整引入** ``` importVuefrom"vue"; importAppfrom"./App.vue"; importrouterfrom"./router"; importstorefrom"./store"; importAntdfrom'ant-design-vue'; import'ant-design-vue/dist/antd.css'; Vue.config.productionTip\=false; Vue.use(Antd); newVue({ router, store, render:(h)\=>h(App), }).$mount("#app"); ``` **局部导入组件** ``` import { Button } from 'ant-design-vue'; Vue.use(Button); ``` 使用 babel-plugin-import 按需加载 ` npm install babel-plugin\-import \--dev` 修改`babel.config.js`文件,配置 babel-plugin-import ``` module.exports\={ presets:\['@vue/cli-plugin-babel/preset'\], plugins:\[\['import',{libraryName:'ant-design-vue',libraryDirectory:'es',style:true}\]\] }; ``` 重新运行报错(`style:true`表示会去编译less文件,但是在编译less文件时就会报下面的错误) ![![](https://img.kancloud.cn/1d/1b/1d1bafcbaeafeb1c0b88b5621600fe13_620x182.png)](images/screenshot_1630637491673.png) `npm install less less\-loader \--save-dev` 安装后还是报错,修改`vue.config.js` ``` module.exports\={ css:{ loaderOptions:{ less:{ lessOptions:{ modifyVars:{ 'primary-color':'#1DA57A', 'link-color':'#1DA57A', 'border-radius-base':'2px', }, javascriptEnabled:true } } } } }; ```