123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <div class="chat-item" v-on="$listeners">
- <div
- class="chat-item-l"
- :class="{ 'chat-item-l-img': img, 'chat-item-l-dot': dot }"
- >
- <img v-if="img" :src="img" alt="" />
- <span v-else>{{ name }}</span>
- <span v-if="dot" class="l-dot"></span>
- </div>
- <div class="chat-item-r">
- <div class="chat-item-r-top">
- <span class="r-title ellipsis visited-hd">{{ title }}</span>
- <span class="r-time" v-if="time">{{ time }}</span>
- </div>
- <div class="chat-item-r-bottom ellipsis" :title="content">
- {{ content }}
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: 'ChatItem',
- props: {
- img: {
- type: String,
- default: ''
- },
- name: {
- type: String,
- default: ''
- },
- title: {
- type: String,
- default: ''
- },
- time: {
- type: [String, Number],
- default: 0
- },
- content: {
- type: String,
- default: ''
- },
- visited: {
- type: Boolean,
- default: false
- },
- dot: {
- type: Boolean,
- default: false
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .chat-item {
- padding: 8px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- cursor: pointer;
- &-l {
- position: relative;
- display: flex;
- width: 36px;
- height: 36px;
- justify-content: center;
- align-items: center;
- margin-right: 6px;
- font-size: 13px;
- border-radius: 50%;
- color: #fff;
- flex-shrink: 0;
- background: #2cb7ca;
- overflow: hidden;
- .l-dot {
- position: absolute;
- right: 0;
- top: 2px;
- width: 6px;
- height: 6px;
- background: #fb483d;
- border: 1px solid #ffffff;
- border-radius: 50%;
- }
- }
- &-l-img {
- background: transparent;
- border: 1px solid #ececec;
- }
- &-l-dot {
- overflow: unset;
- }
- &-r {
- flex: 1;
- width: 0;
- &-top {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .r-title {
- width: 70%;
- font-size: 14px;
- line-height: 22px;
- color: #1d1d1d;
- }
- .r-time {
- margin-left: 6px;
- font-size: 12px;
- line-height: 20px;
- color: #999;
- text-align: right;
- white-space: nowrap;
- }
- &-bottom {
- height: 18px;
- margin-top: 2px;
- color: #686868;
- font-size: 12px;
- line-height: 18px;
- }
- }
- &:hover {
- background: #eaf8fa;
- border-radius: 8px;
- .r-title {
- color: #2cb7ca;
- }
- }
- &:not(:last-child) {
- border-bottom: 1px solid rgba(0, 0, 0, 0.05);
- }
- }
- </style>
|