2020-09-17 13:12:48 +08:00
< template >
< div class = "qq-chat" >
2020-09-25 01:00:28 +08:00
< v-app >
< v-main >
2020-09-17 13:12:48 +08:00
< v-card class = "elevation-6" >
< v-toolbar color = "primary" dark dense flat >
< v-row no -gutters >
< v-col >
< v-row no -gutters justify = "space-between" >
< v-col cols = "auto" >
< v-icon small > fa - chevron - left < / v-icon >
< / v-col >
< v-col cols = "auto" >
< h3 > 🔥 < / h3 >
< / v-col >
< / v-row >
< / v-col >
< v-col cols = "auto" >
< h3 class = "white--text" > NoneBot < / h3 >
< / v-col >
< v-col class = "text-right" >
2020-09-17 18:22:48 +08:00
< v-icon small > fa - user < / v-icon >
2020-09-17 13:12:48 +08:00
< / v-col >
< / v-row >
< / v-toolbar >
< v-container fluid ref = "chat" class = "chat chat-bg" >
< template v-for = "(item, index) in messages" >
< v-row
v - if = "item.position === 'right'"
justify = "end"
: key = "index"
class = "message wow animate__fadeInRight"
data - wow - duration = "0.7s"
>
< div
class = "message-box"
v - html = "
item . msg . replace ( /\n/g , '<br/>' ) . replace ( / /g , ' ' )
"
> < / div >
< v-avatar color = "blue lighten-2" size = "36" >
< v-icon small > fa - user < / v-icon >
< / v-avatar >
< / v-row >
< v-row
v - else - if = "item.position === 'left'"
justify = "start"
: key = "index"
class = "message wow animate__fadeInLeft"
data - wow - duration = "0.7s"
>
< v-avatar color = "transparent" size = "36" >
< v-img src = "/logo.png" > < / v-img >
< / v-avatar >
< div
class = "message-box"
v - html = "
item . msg . replace ( /\n/g , '<br/>' ) . replace ( / /g , ' ' )
"
> < / div >
< / v-row >
< v-row
v - else
justify = "center"
: key = "index"
class = "notify mt-1 wow animate__fadeIn"
data - wow - duration = "0.7s"
>
< div class = "notify-box" >
< span style = "display: inline; white-space: nowrap" >
< v-icon x -small color = "blue" left > fa - info - circle < / v-icon >
< / span >
< span
v - html = "
item . msg . replace ( /\n/g , '<br/>' ) . replace ( / /g , ' ' )
"
> < / span >
< / div >
< / v-row >
< / template >
< / v-container >
< v-container fluid class = "chat-bg py-0" >
< v-row dense class = "mx-0" >
< v-col >
< v-text-field
dense
solo
hide - details
height = "28px"
> < / v-text-field >
< / v-col >
< v-col cols = "auto" >
< v-btn
style = "font-size: 0.8rem"
color = "primary"
small
rounded
depressed
> 发送 < / v - b t n
>
< / v-col >
< / v-row >
< v-row class = "text-center" no -gutters >
< v-col class = "pa-1" cols = "2" >
< v-icon small > fa - microphone < / v-icon >
< / v-col >
< v-col class = "pa-1" cols = "2" >
< v-icon small > fa - image < / v-icon >
< / v-col >
< v-col class = "pa-1" cols = "2" >
< v-icon small > fa - camera < / v-icon >
< / v-col >
< v-col class = "pa-1" cols = "2" >
< v-icon small > fa - wallet < / v-icon >
< / v-col >
< v-col class = "pa-1" cols = "2" >
< v-icon small > fa - smile - wink < / v-icon >
< / v-col >
< v-col class = "pa-1" cols = "2" >
< v-icon small > fa - plus - circle < / v-icon >
< / v-col >
< / v-row >
< / v-container >
2020-09-17 18:22:48 +08:00
< / v-card >
< / v-main >
< / v-app >
2020-09-17 13:12:48 +08:00
< / div >
< / template >
< script >
2021-04-05 16:35:29 +08:00
import { WOW } from "wowjs" ;
import "animate.css/animate.min.css" ;
2020-09-17 13:12:48 +08:00
export default {
2021-04-05 16:35:29 +08:00
name : "Messenger" ,
2020-09-17 13:12:48 +08:00
props : {
messages : {
type : Array ,
2021-04-05 13:44:19 +08:00
default : ( ) => [ ] ,
} ,
2020-09-17 13:12:48 +08:00
} ,
methods : {
2021-04-05 16:35:29 +08:00
initWOW : function ( ) {
2020-09-25 01:00:28 +08:00
new WOW ( {
2021-04-05 16:35:29 +08:00
noxClass : "wow" ,
animateClass : "animate__animated" ,
2020-09-17 13:12:48 +08:00
offset : 0 ,
mobile : true ,
2021-04-05 13:44:19 +08:00
live : true ,
2021-04-05 16:35:29 +08:00
} ) . init ( ) ;
2021-04-05 13:44:19 +08:00
} ,
2020-09-17 13:12:48 +08:00
} ,
mounted ( ) {
2021-04-05 16:35:29 +08:00
this . initWOW ( ) ;
2021-04-05 13:44:19 +08:00
} ,
2021-04-05 16:35:29 +08:00
} ;
2020-09-17 13:12:48 +08:00
< / script >
< style scoped >
. wow {
visibility : hidden ;
}
. chat {
min - height : 150 px ;
2020-09-25 01:00:28 +08:00
overflow - x : hidden ;
2020-09-17 13:12:48 +08:00
}
. chat - bg {
background - color : # f3f6f9 ;
}
. message {
position : relative ;
margin : 0 ;
}
. message . message - box {
position : relative ;
width : fit - content ;
max - width : 55 % ;
border - radius : 0.5 rem ;
padding : 0.6 rem 0.8 rem ;
margin : 0.4 rem 0.8 rem ;
background - color : # fff ;
}
. message . message - box : : after {
2021-04-05 16:35:29 +08:00
content : "" ;
2020-09-17 13:12:48 +08:00
position : absolute ;
right : 100 % ;
top : 0 ;
width : 8 px ;
height : 12 px ;
color : # fff ;
border : 0 solid transparent ;
border - bottom : 7 px solid ;
border - radius : 0 0 0 8 px ;
}
. message . justify - end . message - box : : after {
left : 100 % ;
right : auto ;
border - radius : 0 0 8 px 0 ;
}
. notify {
position : relative ;
}
. notify . notify - box {
max - width : 70 % ;
background : # e0e0e0 ;
border - radius : 10 px ;
padding : 5 px 12 px ;
font - size : 12 px ;
}
< / style >
2020-09-25 01:00:28 +08:00
< style >
. v - application -- wrap {
min - height : 0 ! important ;
}
< / style >