Skip to content

Commit e38e3ed

Browse files
committed
feat: Alert添加文档描述
1 parent 8c07e8a commit e38e3ed

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

src/lib/alert/index.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@
4848
</slot>
4949

5050
<div class="jw-alert-body">
51-
<div class="jw-alert-body-title">{{ title }}</div>
51+
<div class="jw-alert-body-title">
52+
<slot name="title">
53+
{{ title }}
54+
</slot>
55+
</div>
5256
<div class="jw-alert-body-content" v-if="description">
53-
{{ description }}
57+
<slot>{{ description }}</slot>
5458
</div>
5559
</div>
5660
</div>
@@ -84,6 +88,7 @@ const props = defineProps({
8488
center: Boolean,
8589
});
8690
91+
const emits = defineEmits(['close'])
8792
const classes = computed(() => ({
8893
[`jw-alert-${props.type}`]: props.type,
8994
"is-center": props.center,
@@ -94,6 +99,7 @@ const visible = ref(true);
9499
95100
const close = () => {
96101
visible.value = false;
102+
emits('close')
97103
};
98104
</script>
99105
<script lang="ts">

src/views/doc/alert/index.vue

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
<Preview :component="AlertPreview3" />
99
<Preview :component="AlertPreview4" />
1010
<Preview :component="AlertPreview5" />
11+
<Doc title="属性" type="prop" :body="propsDoc" />
12+
<Doc title="事件" type="event" :body="eventDoc" />
13+
<Doc title="插槽" type="slot" :body="slotDoc" />
14+
<PrevAndNext
15+
:prev="{ path: '/doc/switch', name: '开关 Switch' }"
16+
:next="{ path: '/doc/dialog', name: '对话框 Dialog' }"
17+
/>
1118
</div>
1219
</div>
1320
</template>
@@ -19,6 +26,29 @@ import AlertPreview2 from "./AlertPreview2.preview.vue";
1926
import AlertPreview3 from "./AlertPreview3.preview.vue";
2027
import AlertPreview4 from "./AlertPreview4.preview.vue";
2128
import AlertPreview5 from "./AlertPreview5.preview.vue";
29+
import PrevAndNext from "@/components/PrevAndNext.vue";
30+
import Doc from "@/components/Doc.vue";
31+
32+
const propsDoc = [
33+
["title", "标题", "string", "-", "-"],
34+
[
35+
"type",
36+
"类型",
37+
"string",
38+
"default / info / success / warning / error",
39+
"default",
40+
],
41+
["content", "辅助性文字", "string", "-", "-"],
42+
["closable", "是否可关闭", "boolean", "-", "false"],
43+
["center", "文字是否居中", "boolean", "-", "false"],
44+
["show-icon", "是否显示图标", "boolean", "-", "false"],
45+
];
46+
const eventDoc = [["close", "关闭 Alert 时触发的事件", "-"]];
47+
const slotDoc = [
48+
["default", "辅助性文字"],
49+
["icon", "图标"],
50+
["title", "标题"],
51+
];
2252
</script>
2353

2454
<style lang="scss">

src/views/doc/dialog/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Doc title="插槽" type="slot" :body="slotDoc" />
1010
<Doc title="事件" type="event" :body="eventDoc" />
1111
<PrevAndNext
12-
:prev="{ path: '/doc/switch', name: 'Switch 开关 ' }"
12+
:prev="{ path: '/doc/alert', name: 'Alert 提示' }"
1313
:next="{ path: '/doc/Affix', name: '固钉 Affix' }"
1414
/>
1515
</div>

src/views/doc/switch/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Doc title="属性" type="prop" :body="propDoc" />
99
<PrevAndNext
1010
:prev="{ path: '/doc/select', name: 'Select 选择器' }"
11-
:next="{ path: '/doc/dialog', name: '对话框 Dialog' }"
11+
:next="{ path: '/doc/alert', name: '提示 Alert' }"
1212
/>
1313
</div>
1414
</template>

0 commit comments

Comments
 (0)