方法一: 自定义插槽
<a-select
class="search ml-2"
v-model:value="searchWordId"
placeholder="请输入关键词名称"
show-search
:options="wordOptions"
:filter-option="false"
:allowClear="true"
:showArrow="false"
@search="searchWord"
@change="addCheckedWord"
>
<template v-slot:notFoundContent>
<div class="empty text-center">
<a-image :src="emptyImgUrl" width="85px" :preview="false"/>
<div>未搜索到关键词,
<a-button class="pl-0" type="link" @click="openAddKeyWord">新增关键词</a-button>
</div>
</div>
// 或使用empty组件
// <a-empty :image="emptyImgUrl" :description="未搜索到关键词"/>
</template>
</a-select>
方法二: 全局配置
(可覆盖select、table、cascader等)
文档: antd-v文档地址
// 写在app.vue中
<template>
<a-config-provider>
<template #renderEmpty>
<div style="text-align: center">
<a-empty :image="emptyImgUrl" :description="暂无数据"/>
</div>
</template>
<router-view ></router-view>
</a-config-provider>
</template>