16 changed files with 438 additions and 380 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,47 @@ |
|||||||
|
<template> |
||||||
|
<div class="edit" contenteditable @input="changeText">{{ innerText }}</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
export default { |
||||||
|
name: "AutoInput", |
||||||
|
props: { |
||||||
|
modelValue: String, |
||||||
|
}, |
||||||
|
data: function () { |
||||||
|
return { |
||||||
|
innerText: this.modelValue, |
||||||
|
} |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
changeText(e) { |
||||||
|
this.$emit('update:modelValue', this.$el.innerText); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
.edit { |
||||||
|
width: 100%; |
||||||
|
max-height: 70px; |
||||||
|
background: #eee; |
||||||
|
overflow-y: scroll; |
||||||
|
padding: 8px 10px; |
||||||
|
border-radius: 30px; |
||||||
|
outline: none; |
||||||
|
} |
||||||
|
|
||||||
|
.edit::-webkit-scrollbar { |
||||||
|
width: 0 !important |
||||||
|
} |
||||||
|
|
||||||
|
.edit:empty::before { |
||||||
|
content: "留下你的精彩评论吧"; |
||||||
|
color: #999999; |
||||||
|
} |
||||||
|
|
||||||
|
.edit:focus::before { |
||||||
|
content: none; |
||||||
|
} |
||||||
|
</style> |
@ -1,211 +1,168 @@ |
|||||||
<template> |
<template> |
||||||
<transition name="comment"> |
<transition name="comment"> |
||||||
<div class="comment f14" v-if="isCommenting"> |
<div class="comment f14" v-if="isCommenting"> |
||||||
<div class="title mt10p"> |
<div class="title mt10p"> |
||||||
<p>2.7w条评论</p> |
<p>2.7w条评论</p> |
||||||
<img src="../assets/img/icon/close.svg" @click.stop="$emit('update:is-commenting',false)"> |
<img src="../assets/img/icon/close.svg" @click.stop="$emit('update:is-commenting',false)"> |
||||||
</div> |
</div> |
||||||
<div class="items"> |
<div class="items"> |
||||||
<div class="item pl5p pr15p mb5p oh"> |
<div class="item pl5p pr15p mb5p oh" |
||||||
<div class="content pull-left "> |
v-for="item in 2" |
||||||
<img src="../assets/img/icon/head-image.jpeg" alt="" class="head-image pull-left"> |
> |
||||||
<div class="pull-right comment-container"> |
<div class="content pull-left "> |
||||||
<div class="name">@ttentau</div> |
<img src="../assets/img/icon/head-image.jpeg" alt="" class="head-image pull-left"> |
||||||
<div class="detail">其实我也不知道评论点什么啊啊啊看吧看吧看吧</div> |
<div class="pull-right comment-container"> |
||||||
<div class="time mt10p">10-02</div> |
<div class="name">@ttentau</div> |
||||||
</div> |
<div class="detail">其实我也不知道评论点什么啊啊啊看吧看吧看吧</div> |
||||||
</div> |
<div class="time mt10p">10-02</div> |
||||||
<div class="love pull-right"> |
|
||||||
<img src="../assets/img/icon/love-gray.svg" alt="" class="love-image"> |
|
||||||
<span class="f14 block">3453</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="item pl5p pr15p mb5p oh"> |
|
||||||
<div class="content pull-left "> |
|
||||||
<img src="../assets/img/icon/head-image.jpeg" alt="" class="head-image pull-left"> |
|
||||||
<div class="pull-right comment-container"> |
|
||||||
<div class="name">@ttentau</div> |
|
||||||
<div class="detail">其实我也不知道评论点什么啊啊啊看吧看吧看吧</div> |
|
||||||
<div class="time mt10p">10-02</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="love pull-right"> |
|
||||||
<img src="../assets/img/icon/love-gray.svg" alt="" class="love-image"> |
|
||||||
<span class="f14 block">3453</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="item pl5p pr15p mb5p oh"> |
|
||||||
<div class="content pull-left "> |
|
||||||
<img src="../assets/img/icon/head-image.jpeg" alt="" class="head-image pull-left"> |
|
||||||
<div class="pull-right comment-container"> |
|
||||||
<div class="name">@ttentau</div> |
|
||||||
<div class="detail">其实我也不知道评论点什么啊啊啊看吧看吧看吧</div> |
|
||||||
<div class="time mt10p">10-02</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="love pull-right"> |
|
||||||
<img src="../assets/img/icon/love-gray.svg" alt="" class="love-image"> |
|
||||||
<span class="f14 block">3453</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="item pl5p pr15p mb5p oh"> |
|
||||||
<div class="content pull-left "> |
|
||||||
<img src="../assets/img/icon/head-image.jpeg" alt="" class="head-image pull-left"> |
|
||||||
<div class="pull-right comment-container"> |
|
||||||
<div class="name">@ttentau</div> |
|
||||||
<div class="detail">其实我也不知道评论点什么啊啊啊看吧看吧看吧</div> |
|
||||||
<div class="time mt10p">10-02</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="love pull-right"> |
|
||||||
<img src="../assets/img/icon/love-gray.svg" alt="" class="love-image"> |
|
||||||
<span class="f14 block">3453</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="item pl5p pr15p mb5p oh"> |
|
||||||
<div class="content pull-left "> |
|
||||||
<img src="../assets/img/icon/head-image.jpeg" alt="" class="head-image pull-left"> |
|
||||||
<div class="pull-right comment-container"> |
|
||||||
<div class="name">@ttentau</div> |
|
||||||
<div class="detail">其实我也不知道评论点什么啊啊啊看吧看吧看吧</div> |
|
||||||
<div class="time mt10p">10-02</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="love pull-right"> |
|
||||||
<img src="../assets/img/icon/love-gray.svg" alt="" class="love-image"> |
|
||||||
<span class="f14 block">3453</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="item pl5p pr15p mb5p oh"> |
|
||||||
<div class="content pull-left "> |
|
||||||
<img src="../assets/img/icon/head-image.jpeg" alt="" class="head-image pull-left"> |
|
||||||
<div class="pull-right comment-container"> |
|
||||||
<div class="name">@ttentau</div> |
|
||||||
<div class="detail">其实我也不知道评论点什么啊啊啊看吧看吧看吧</div> |
|
||||||
<div class="time mt10p">10-02</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="love pull-right"> |
|
||||||
<img src="../assets/img/icon/love-gray.svg" alt="" class="love-image"> |
|
||||||
<span class="f14 block">3453</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="item pl5p pr15p mb5p oh"> |
|
||||||
<div class="content pull-left "> |
|
||||||
<img src="../assets/img/icon/head-image.jpeg" alt="" class="head-image pull-left"> |
|
||||||
<div class="pull-right comment-container"> |
|
||||||
<div class="name">@ttentau</div> |
|
||||||
<div class="detail">其实我也不知道评论点什么啊啊啊看吧看吧看吧</div> |
|
||||||
<div class="time mt10p">10-02</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="love pull-right"> |
|
||||||
<img src="../assets/img/icon/love-gray.svg" alt="" class="love-image"> |
|
||||||
<span class="f14 block">3453</span> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="input-comment"> |
|
||||||
<input type="text" placeholder="留下你的精彩评论哦"> |
|
||||||
<span>@</span> |
|
||||||
</div> |
</div> |
||||||
|
</div> |
||||||
|
<div class="love pull-right"> |
||||||
|
<img src="../assets/img/icon/love-gray.svg" alt="" class="love-image"> |
||||||
|
<span class="f14 block">3453</span> |
||||||
|
</div> |
||||||
</div> |
</div> |
||||||
</transition> |
<p class="no-more">暂时没有更多了</p> |
||||||
|
</div> |
||||||
|
<div class="input-comment"> |
||||||
|
<AutoInput v-model="commit"></AutoInput> |
||||||
|
<div class="options"> |
||||||
|
<img src="../assets/img/icon/add.svg" alt="" @click="call"> |
||||||
|
<img src="../assets/img/icon/add.svg" alt=""> |
||||||
|
<img src="../assets/img/icon/add.svg" alt=""> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</transition> |
||||||
|
|
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
export default { |
import AutoInput from "./AutoInput"; |
||||||
name: "Comment", |
|
||||||
props: ['isCommenting'], |
export default { |
||||||
methods: { |
name: "Comment", |
||||||
// showComment() { |
components: {AutoInput}, |
||||||
// this.isCommenting = !this.isCommenting; |
props: ['isCommenting'], |
||||||
// console.log(666) |
data() { |
||||||
// } |
return { |
||||||
} |
commit: '' |
||||||
|
} |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
// showComment() { |
||||||
|
// this.isCommenting = !this.isCommenting; |
||||||
|
// console.log(666) |
||||||
|
// } |
||||||
|
call(){ |
||||||
|
console.log(this.commit) |
||||||
} |
} |
||||||
|
} |
||||||
|
} |
||||||
</script> |
</script> |
||||||
|
|
||||||
<style lang="scss" scoped> |
<style lang="scss" scoped> |
||||||
.comment { |
|
||||||
position: fixed; |
.comment { |
||||||
/*top: 200px;*/ |
position: fixed; |
||||||
width: 100%; |
/*top: 200px;*/ |
||||||
bottom: 0; |
width: 100%; |
||||||
background: #fff; |
bottom: 0; |
||||||
z-index: 5; |
background: #fff; |
||||||
border-radius: 10px 10px 0 0; |
z-index: 5; |
||||||
.title { |
border-radius: 10px 10px 0 0; |
||||||
position: relative; |
|
||||||
p { |
.title { |
||||||
text-align: center; |
position: relative; |
||||||
} |
|
||||||
img { |
p { |
||||||
width: 15px; |
text-align: center; |
||||||
height: 15px; |
} |
||||||
position: absolute; |
|
||||||
right: 20px; |
img { |
||||||
top: 0; |
width: 15px; |
||||||
} |
height: 15px; |
||||||
} |
position: absolute; |
||||||
.input-comment { |
right: 20px; |
||||||
height: 30px; |
top: 0; |
||||||
border-top: 1px solid #e2e1e1; |
} |
||||||
input { |
} |
||||||
height: 100%; |
|
||||||
width: 90%; |
.items { |
||||||
} |
overflow-y: scroll; |
||||||
span { |
height: 60vh; |
||||||
color: #999; |
|
||||||
font-size: 22px; |
.item { |
||||||
} |
.head-image { |
||||||
|
width: 40px; |
||||||
|
border-radius: 50%; |
||||||
|
float: left; |
||||||
|
} |
||||||
|
|
||||||
|
.content { |
||||||
|
float: left; |
||||||
|
width: 85%; |
||||||
|
|
||||||
|
.head-image { |
||||||
|
width: 15%; |
||||||
} |
} |
||||||
.items { |
|
||||||
overflow-y: scroll; |
.comment-container { |
||||||
max-height: 300px; |
width: 80%; |
||||||
.item { |
|
||||||
.head-image { |
.time { |
||||||
width: 40px; |
color: gray; |
||||||
border-radius: 50%; |
} |
||||||
float: left; |
|
||||||
} |
|
||||||
.content { |
|
||||||
float: left; |
|
||||||
width: 85%; |
|
||||||
.head-image { |
|
||||||
width: 15%; |
|
||||||
} |
|
||||||
.comment-container { |
|
||||||
width: 80%; |
|
||||||
.time { |
|
||||||
color: gray; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
.love { |
|
||||||
text-align: center; |
|
||||||
.love-image { |
|
||||||
width: 30px; |
|
||||||
border-radius: 50%; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
|
.love { |
||||||
|
text-align: center; |
||||||
|
|
||||||
.comment-enter-active { |
.love-image { |
||||||
transition: all .3s ease; |
width: 30px; |
||||||
|
border-radius: 50%; |
||||||
|
} |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
.comment-leave-active { |
.no-more{ |
||||||
transition: all .3s ease; |
margin: 10px; |
||||||
|
text-align: center; |
||||||
|
color: #ccc; |
||||||
} |
} |
||||||
|
} |
||||||
|
|
||||||
|
.input-comment { |
||||||
|
padding: 10px; |
||||||
|
border-top: 1px solid #e2e1e1; |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
|
||||||
|
.options { |
||||||
|
display: flex; |
||||||
|
|
||||||
|
img { |
||||||
|
width: 20px; |
||||||
|
height: 20px; |
||||||
|
margin: 0 5px; |
||||||
|
|
||||||
.comment-enter, .comment-leave-to { |
&:nth-last-child(1) { |
||||||
transform: translateY(300px); |
margin-right: 0; |
||||||
|
} |
||||||
|
} |
||||||
} |
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.comment-enter-active, |
||||||
|
.comment-leave-active { |
||||||
|
transition: all .15s ease; |
||||||
|
} |
||||||
|
|
||||||
|
.comment-enter-from, .comment-leave-to { |
||||||
|
transform: translateY(60vh); |
||||||
|
} |
||||||
|
|
||||||
</style> |
</style> |
||||||
|
Loading…
Reference in new issue