Skip to content

Commit c6b2cf8

Browse files
jiaoxueyanjiaoxueyan
andauthored
feat: ✨ StatusTip缺省提示组件提供图片内容插槽(#538) (#615)
Closes: #538 Co-authored-by: jiaoxueyan <jiaoxueyan@megarobo.tech>
1 parent 43a5da6 commit c6b2cf8

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

docs/component/status-tip.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@
5454
<wd-status-tip image="https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg" tip="查看我的头像" />
5555
```
5656

57+
## 自定义图片内容
58+
59+
使用插槽 `image` 可以自定义图片内容。
60+
61+
```html
62+
<wd-status-tip tip="自定义图片内容">
63+
<template #image>
64+
<wd-icon name="ie-filled" size="100px"></wd-icon>
65+
</template>
66+
</wd-status-tip>
67+
```
68+
5769
## Attributes
5870

5971
| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
@@ -70,3 +82,9 @@
7082
| ------ | ------------------------- | ---------------- | ------ | ------ | -------- |
7183
| height | 图片高度,默认单位为 `px` | string \| number | - | - | 1.2.12 |
7284
| width | 图片宽度,默认单位为 `px` | string \| number | - | - | 1.2.12 |
85+
86+
## Slot
87+
88+
| name | 说明 | 最低版本 |
89+
| ------- | ------------------------ | -------- |
90+
| image | 图片内容 | $LOWEST_VERSION$ |

src/pages/statusTip/Index.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
<demo-block title="自定义图片">
4343
<wd-status-tip image="https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg" tip="查看我的头像" />
4444
</demo-block>
45+
46+
<demo-block title="插槽自定义图片内容">
47+
<wd-status-tip tip="插槽自定义图片内容">
48+
<template #image>
49+
<wd-icon name="ie-filled" size="100px"></wd-icon>
50+
</template>
51+
</wd-status-tip>
52+
</demo-block>
4553
</page-wraper>
4654
</template>
4755
<script lang="ts" setup></script>

src/uni_modules/wot-design-uni/components/wd-status-tip/wd-status-tip.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<!--
22
* @Author: weisheng
33
* @Date: 2023-06-12 10:04:19
4-
* @LastEditTime: 2024-09-19 14:44:17
5-
* @LastEditors: weisheng
4+
* @LastEditTime: 2024-09-20 10:23:38
5+
* @LastEditors: jiaoxueyan
66
* @Description:
77
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-status-tip\wd-status-tip.vue
88
* 记得注释
99
-->
1010
<template>
1111
<view :class="`wd-status-tip ${customClass}`" :style="customStyle">
12-
<wd-img v-if="imgUrl" :mode="imageMode" :src="imgUrl" custom-class="wd-status-tip__image" :custom-style="imgStyle"></wd-img>
12+
<slot name="image" v-if="$slots.image"></slot>
13+
<wd-img v-else-if="imgUrl" :mode="imageMode" :src="imgUrl" custom-class="wd-status-tip__image" :custom-style="imgStyle"></wd-img>
1314
<view v-if="tip" class="wd-status-tip__text">{{ tip }}</view>
1415
</view>
1516
</template>

0 commit comments

Comments
 (0)