16 changed files with 438 additions and 380 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,47 @@
@@ -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 @@
@@ -1,211 +1,168 @@
|
||||
<template> |
||||
<transition name="comment"> |
||||
<div class="comment f14" v-if="isCommenting"> |
||||
<div class="title mt10p"> |
||||
<p>2.7w条评论</p> |
||||
<img src="../assets/img/icon/close.svg" @click.stop="$emit('update:is-commenting',false)"> |
||||
</div> |
||||
<div class="items"> |
||||
<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 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> |
||||
<transition name="comment"> |
||||
<div class="comment f14" v-if="isCommenting"> |
||||
<div class="title mt10p"> |
||||
<p>2.7w条评论</p> |
||||
<img src="../assets/img/icon/close.svg" @click.stop="$emit('update:is-commenting',false)"> |
||||
</div> |
||||
<div class="items"> |
||||
<div class="item pl5p pr15p mb5p oh" |
||||
v-for="item in 2" |
||||
> |
||||
<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> |
||||
</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> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "Comment", |
||||
props: ['isCommenting'], |
||||
methods: { |
||||
// showComment() { |
||||
// this.isCommenting = !this.isCommenting; |
||||
// console.log(666) |
||||
// } |
||||
} |
||||
import AutoInput from "./AutoInput"; |
||||
|
||||
export default { |
||||
name: "Comment", |
||||
components: {AutoInput}, |
||||
props: ['isCommenting'], |
||||
data() { |
||||
return { |
||||
commit: '' |
||||
} |
||||
}, |
||||
methods: { |
||||
// showComment() { |
||||
// this.isCommenting = !this.isCommenting; |
||||
// console.log(666) |
||||
// } |
||||
call(){ |
||||
console.log(this.commit) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.comment { |
||||
position: fixed; |
||||
/*top: 200px;*/ |
||||
width: 100%; |
||||
bottom: 0; |
||||
background: #fff; |
||||
z-index: 5; |
||||
border-radius: 10px 10px 0 0; |
||||
.title { |
||||
position: relative; |
||||
p { |
||||
text-align: center; |
||||
} |
||||
img { |
||||
width: 15px; |
||||
height: 15px; |
||||
position: absolute; |
||||
right: 20px; |
||||
top: 0; |
||||
} |
||||
} |
||||
.input-comment { |
||||
height: 30px; |
||||
border-top: 1px solid #e2e1e1; |
||||
input { |
||||
height: 100%; |
||||
width: 90%; |
||||
} |
||||
span { |
||||
color: #999; |
||||
font-size: 22px; |
||||
} |
||||
|
||||
.comment { |
||||
position: fixed; |
||||
/*top: 200px;*/ |
||||
width: 100%; |
||||
bottom: 0; |
||||
background: #fff; |
||||
z-index: 5; |
||||
border-radius: 10px 10px 0 0; |
||||
|
||||
.title { |
||||
position: relative; |
||||
|
||||
p { |
||||
text-align: center; |
||||
} |
||||
|
||||
img { |
||||
width: 15px; |
||||
height: 15px; |
||||
position: absolute; |
||||
right: 20px; |
||||
top: 0; |
||||
} |
||||
} |
||||
|
||||
.items { |
||||
overflow-y: scroll; |
||||
height: 60vh; |
||||
|
||||
.item { |
||||
.head-image { |
||||
width: 40px; |
||||
border-radius: 50%; |
||||
float: left; |
||||
} |
||||
|
||||
.content { |
||||
float: left; |
||||
width: 85%; |
||||
|
||||
.head-image { |
||||
width: 15%; |
||||
} |
||||
.items { |
||||
overflow-y: scroll; |
||||
max-height: 300px; |
||||
.item { |
||||
.head-image { |
||||
width: 40px; |
||||
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%; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.comment-container { |
||||
width: 80%; |
||||
|
||||
.time { |
||||
color: gray; |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
.love { |
||||
text-align: center; |
||||
|
||||
.comment-enter-active { |
||||
transition: all .3s ease; |
||||
.love-image { |
||||
width: 30px; |
||||
border-radius: 50%; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.comment-leave-active { |
||||
transition: all .3s ease; |
||||
.no-more{ |
||||
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 { |
||||
transform: translateY(300px); |
||||
&:nth-last-child(1) { |
||||
margin-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.comment-enter-active, |
||||
.comment-leave-active { |
||||
transition: all .15s ease; |
||||
} |
||||
|
||||
.comment-enter-from, .comment-leave-to { |
||||
transform: translateY(60vh); |
||||
} |
||||
|
||||
</style> |
||||
|
Loading…
Reference in new issue