先确定下是不是3.0哦 ,下面的方式是3.0的方法,vue2.0的方法在官网
https://www.antdv.com/docs/vue/introduce
确定3.0需要打开main.js
写法是
import { createApp } from 'vue' 这样的 就是 3.0拉
1.先引入
npm install ant-design-vue --save
2.安装好之后打开main.js
import Antd from 'ant-design-vue';
createApp(App).use(Antd)
3.页面测试(随便打开一个页面,赋值下面代码)
<template>
<a-button type="primary">Primary Button</a-button>
<a-button>Default Button</a-button>
<a-button type="dashed">Dashed Button</a-button>
<a-button type="text">Text Button</a-button>
<a-button type="link">Link Button</a-button>
</template>
4.运行看一下
如下图就是成功引入了
注意:
安装ant-design-vue@next后,项目控制台出现这个错误↓
Error: Cannot find module 'vue-loader-v16/package.json'
重新执行npm i或者yarn,再重新运行即可