Antdesign for VUE入门
(全局完整注册方式)
1.首先创建项目
vue create anttest3
2.安装
开始使用官方教材的命令,报错:Unable to resolve dependency tree.
后来同事说我的VUE 2.0版本不能装太高版本的ant-design版本,要用1的版本。
于是修改命令:
npm i --save ant-design-vue@1.7.8
这样就没有再报错,后面就很顺利了。
3.在main.js文件中引用
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
Vue.use(Antd);
4.在app.vue文件中使用样式
<template>
<div id="app">
<h1>antd version:测试</h1>
<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>
<br>
<a-button type="primary">
测试按钮
</a-button>
</div>
</template>