remove empty-tips replace for center-tips

This commit is contained in:
Timi
2026-10-12 16:29:28 +08:00
parent efd683e808
commit 5e4b7404d8
9 changed files with 58 additions and 36 deletions
+19
View File
@@ -0,0 +1,19 @@
# CenterTips 居中提示
在容器中显示居中提示文案。
## 基础用法
:::preview 基础用法 || 默认文案为「没有更多数据」,也可以使用默认插槽
demo-preview=../demos/center-tips/basic.vue
:::
## 何时使用
默认插槽内容会替换默认文案,可用于放入自定义提示或操作。
## API
<api-table name="CenterTips" />
-19
View File
@@ -1,19 +0,0 @@
# EmptyTips 空状态
列表或容器无数据时的居中占位文案。
## 基础用法
:::preview 基础用法 || 默认文案为「没有更多数据」,可整体替换
demo-preview=../demos/empty-tips/basic.vue
:::
## 何时使用
列表请求成功但没有数据、或筛选后结果为空时使用。它只负责一行居中文字,需要插图或操作按钮时请自行组合。
## API
<api-table name="EmptyTips" />
+1 -1
View File
@@ -8,7 +8,7 @@
| --- | --- |
| [Icon](/components/icon) | 内置 149 个 SVG 图标,支持缩放、着色与禁用态。 |
| [Loading](/components/loading) | 四段线动画的加载指示器,可延迟显示并支持内联或铺满两种形态。 |
| [EmptyTips](/components/empty-tips) | 列表或容器无数据时的居中占位文案。 |
| [CenterTips](/components/center-tips) | 在容器中显示居中提示文案。 |
| [Copyright](/components/copyright) | 统一页脚:版权声明、备案号与自定义文案。 |
## 数据展示
@@ -1,16 +1,19 @@
<template>
<div class="demo">
<div class="box">
<empty-tips />
<center-tips />
</div>
<div class="box">
<empty-tips content="暂无权限查看该内容" />
<center-tips content="暂无权限查看该内容" />
</div>
<div class="box">
<center-tips>使用默认插槽自定义提示</center-tips>
</div>
</div>
</template>
<script lang="ts" setup>
import { EmptyTips } from "timi-web";
import { CenterTips } from "timi-web";
</script>
<style lang="less" scoped>
+13
View File
@@ -0,0 +1,13 @@
import view from "./index.vue";
import WebToolkit from "../../utils/WebToolkit";
import type { App } from "vue";
export const CenterTips = WebToolkit.withInstall(view);
CenterTips.install = (app: App) => {
app.component("CenterTips", CenterTips);
app.component("EmptyTips", CenterTips);
};
/** 兼容旧组件名。 */
export const EmptyTips = CenterTips;
export default CenterTips;
@@ -1,11 +1,15 @@
<template>
<div class="tui-empty-tips gray" v-text="content"></div>
<div class="tui-center-tips gray">
<slot>
<span v-text="content" />
</slot>
</div>
</template>
<script lang="ts" setup>
defineOptions({
name: "EmptyTips"
name: "CenterTips"
});
withDefaults(defineProps<{
@@ -16,10 +20,10 @@ withDefaults(defineProps<{
</script>
<style lang="less" scoped>
.tui-empty-tips {
.tui-center-tips {
width: 100%;
padding: 1rem 0;
font-size: 14px;
padding: .5rem 0;
font-size: .875rem;
text-align: center;
}
</style>
-5
View File
@@ -1,5 +0,0 @@
import view from "./index.vue";
import WebToolkit from "../../utils/WebToolkit";
export const EmptyTips = WebToolkit.withInstall(view);
export default EmptyTips;
+3 -2
View File
@@ -5,7 +5,7 @@ import HoverPopup, { VPopupComponent } from "./v-popup";
import Captcha from "./captcha";
import Loading from "./loading";
import Copyright from "./copyright";
import EmptyTips from "./empty-tips";
import CenterTips, { EmptyTips } from "./center-tips";
import MarkdownView from "./markdown-view";
import BEFlowerFall from "./background-effect/flower-fall";
import MarkdownEditor from "./markdown-editor";
@@ -21,7 +21,7 @@ export default [
Captcha,
Loading,
Copyright,
EmptyTips,
CenterTips,
MarkdownView,
BEFlowerFall,
MarkdownEditor,
@@ -39,6 +39,7 @@ export {
Captcha,
Loading,
Copyright,
CenterTips,
EmptyTips,
MarkdownView,
BEFlowerFall,
+7 -1
View File
@@ -46,7 +46,13 @@ export default defineConfig({
include: [/\.vue$/, /\.md$/]
}),
VueSetupExtend(),
dts(),
dts({
// package.json 的 types 与 exports 指向 dist/src/**。
// 不显式固定根目录时,插件会按 tsconfig include 推断公共根,
// include 一旦变化(例如移除 examples 目录)声明产物就会从
// dist/src/** 漂移到 dist/**,进而让所有引用本包类型的地方报错。
entryRoot: "."
}),
prismjsPlugin({
languages: [
"ini",