Skip to content

Commit 6b7b6b9

Browse files
aubrydarioDario Aubry
authored andcommitted
(feat) add named slots for customization
1 parent eaed24a commit 6b7b6b9

File tree

6 files changed

+365
-284
lines changed

6 files changed

+365
-284
lines changed

src/ChatWindow/ChatWindow.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
@fetchRoom="fetchRoom"
1616
@addRoom="addRoom"
1717
>
18-
<template v-slot:rooms-header>
19-
<slot name="rooms-header"></slot>
18+
<template v-for="(index, name) in $scopedSlots" v-slot:[name]="data">
19+
<slot :name="name" v-bind="data"></slot>
2020
</template>
2121
</rooms-list>
2222

@@ -52,6 +52,9 @@
5252
@sendMessageReaction="sendMessageReaction"
5353
@typingMessage="typingMessage"
5454
>
55+
<template v-for="(index, name) in $scopedSlots" v-slot:[name]="data">
56+
<slot :name="name" v-bind="data"></slot>
57+
</template>
5558
</room>
5659
</div>
5760
</div>

src/ChatWindow/EmojiPicker.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
@click.stop="clickEvent"
1010
@click="openEmoji"
1111
>
12-
<svg-icon name="emoji" :param="emojiReaction ? 'reaction' : ''" />
12+
<slot name="emoji-picker-icon">
13+
<svg-icon name="emoji" :param="emojiReaction ? 'reaction' : ''" />
14+
</slot>
1315
</div>
1416
<div
1517
slot="emoji-picker"

src/ChatWindow/FormatMessage.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
}"
2020
:href="message.href"
2121
target="_blank"
22-
><svg-icon v-if="deleted" name="deleted" class="icon-deleted" />{{
23-
message.value
24-
}}</component
2522
>
23+
<slot name="deleted-icon" v-bind="{ deleted }">
24+
<svg-icon v-if="deleted" name="deleted" class="icon-deleted" />{{
25+
message.value
26+
}}</slot>
27+
</component>
2628
</template>
2729
</div>
2830
<div v-else>{{ content }}</div>

0 commit comments

Comments
 (0)