kana-bbs/components/DialogueList.vue
2024-04-20 20:13:28 +08:00

52 lines
1.2 KiB
Vue

<template lang="pug">
.dialogue-list
.post(v-for="item in data", :key="item._id")
.left
div.avatar(v-if="item.user.name === '游客'")
img.avatar(v-else :src="item.user.avatar" onerror="this.src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'")
.right
.name {{ item.user.name }}
.message {{ item.data }}
</template>
<script>
export default {
props: ["data"],
};
</script>
<style lang="sass" scoped>
.dialogue-list
.post
display: flex
margin: 1rem 0
.left
justify-content: center
align-items: center
.avatar
width: 2rem
height: 2rem
background: #dddddd
border-radius: 50%
margin: .5rem auto
.right
padding: 0 2rem
.name
color: #999
font-size: .8rem
.message
background: #ffffff
padding: 1rem
border-radius: 1rem
position: relative
&::before
content: ""
position: absolute
top: 10px
left: -1rem
border-top: 20px solid #ffffff
border-left: 1rem solid transparent
border-right: 1rem solid transparent
</style>