kana-bbs/components/ThreadList.vue

64 lines
1.5 KiB
Vue
Raw Normal View History

2022-01-30 13:34:10 +08:00
<template lang="pug">
.thread-list
ul(v-if="data.length")
li(v-for="item in data", :key="item._id")
2022-01-31 02:34:36 +08:00
NuxtLink(:to="'/user/' + item.user._id")
2024-04-16 20:06:06 +08:00
img.avatar(:src="item.user.avatar" onerror="this.src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'")
2022-01-30 17:37:25 +08:00
NuxtLink.content(:to="'/thread/' + item._id")
.title {{ item.title }}
.info
span {{ item.user.name }}
span {{ rwdate(item.createdAt) }}
2022-01-30 13:34:10 +08:00
.thread-none(v-else) 没有内容~
</template>
<style lang="sass">
.thread-none
display: flex
justify-content: center
align-items: center
justify-items: center
text-align: center
min-height: 24rem
.thread-list
ul
list-style: none
padding: 0
margin: 0
2022-01-30 17:37:25 +08:00
li
2022-01-30 13:34:10 +08:00
display: flex
align-items: center
border-radius: .5rem
height: 48px
margin: 0
padding: 8px 0
.avatar
width: 48px
height: 48px
background: rgba(0, 0, 0, .05)
border-radius: 50%
overflow: hidden
2022-02-08 03:37:22 +08:00
margin-right: .5rem
2022-01-30 13:34:10 +08:00
.content
2022-01-30 17:37:25 +08:00
flex: 1
2022-01-30 13:34:10 +08:00
.title
font-size: 1.1rem
font-weight: 600
.info
span
margin-right: .5rem
2022-01-30 17:37:25 +08:00
li:hover
2022-01-30 13:34:10 +08:00
background: rgba(0, 0, 0, .025)
</style>
<script>
export default {
props: ["data"],
2022-01-30 17:37:25 +08:00
methods: {
rwdate(utc) {
let t = new Date(utc);
return t.getMonth() + 1 + "月 " + t.getDate() + ", " + t.getFullYear();
2024-04-16 20:06:06 +08:00
}
2022-01-30 17:37:25 +08:00
},
2022-01-30 13:34:10 +08:00
};
</script>