Article Directory
Install
npm install [email protected] --save
npm i --save ant-design-vue@next
npm i --save ant-design-vue //目前使用的兼容版本"ant-design-vue": "^2.2.8",
The project introduces global components
common problem
keyword to avoid
Handle validation exceptions es-link
error The “HelloWorld” component has been registered but not used vue/no-unused-components
stack overflow
ant gallery not loaded
git
Append to last commit file
easy to use
Custom component-header
Components can, small hump big hump, - link
the-header component
<template>
<a-layout-header class="header">
<div class="logo" />
<a-menu
theme="dark"
mode="horizontal"
v-model:selectedKeys="selectedKeys1"
:style="{ lineHeight: '64px' }"
>
<a-menu-item key="1">nav 11</a-menu-item>
<a-menu-item key="2">nav 2</a-menu-item>
<a-menu-item key="3">nav 3</a-menu-item>
</a-menu>
</a-layout-header>
</template>
<script lang="ts">
import {
defineComponent } from 'vue';
export default defineComponent({
name: 'the-header'
});
</script>
<style scoped>
</style>
reference component
<the-header></the-header>
<script lang="ts">
import {
defineComponent } from 'vue';
import TheHeader from '@/components/the-header.vue';
export default defineComponent({
name: 'app',
components: {
TheHeader,
}
});
</script>
the list
add any question ts type
ts type any becomes js unlimited type, if there is an error message
icon iocn
Install npm install @ant-design/icons-vue --save
main.ts to import globally, the official document seems to need to introduce troubles one by one
import * as Icons from '@ant-design/icons-vue';
// createApp(App).use(store).use(router).use(Antd).mount('#app'); // 链式变动
const app = createApp(App);
app.use(store).use(router).use(Antd).mount('#app');
// 全局使用图标
const icons: any = Icons;
for (const i in icons) {
app.component(i, icons[i]);
}