聊天界面自适应高度

pull/30/head
taoshihan1991 4 years ago
parent b4b70e2972
commit e2fe179493

@ -25,7 +25,7 @@
position: relative; position: relative;
} }
.chatBox{ .chatBox{
max-height: 500px; max-height: 600px;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
margin-bottom: 80px; margin-bottom: 80px;
@ -48,6 +48,7 @@
position: relative; position: relative;
border-radius: 5px; border-radius: 5px;
display: inline-block; display: inline-block;
margin-left: 6px;
} }
.chatContent:after { .chatContent:after {
content: ''; content: '';
@ -97,7 +98,7 @@
type="success"> type="success">
</el-alert> </el-alert>
<el-row :gutter="2" v-for="v in msgList" v-bind:class="{'chatBoxMe': v.is_kefu==true}"> <el-row :gutter="2" v-for="v in msgList" v-bind:class="{'chatBoxMe': v.is_kefu==true}">
<el-col :span="3"><el-avatar :size="60" :src="v.avator"></el-avatar></el-col> <el-col :span="3"><el-avatar :src="v.avator"></el-avatar></el-col>
<el-col :span="21"> <el-col :span="21">
<div class="chatUser"><{v.name}></div> <div class="chatUser"><{v.name}></div>
<div class="chatContent"><{v.content}></div> <div class="chatContent"><{v.content}></div>
@ -106,10 +107,10 @@
<div class="chatTime" v-bind:class="{'chatTimeHide': v.show_time==false}"><{v.time}></div> <div class="chatTime" v-bind:class="{'chatTimeHide': v.show_time==false}"><{v.time}></div>
</el-row> </el-row>
</div> </div>
<div class="chatBoxSend"> </div>
<el-input type="textarea" class="chatArea" v-model="messageContent" v-on:keyup.enter.native="chatToUser"></el-input> <div class="chatBoxSend">
<el-button type="primary" class="chatBoxSendBtn" size="small" v-on:click="chatToUser">发送</el-button> <el-input type="textarea" class="chatArea" v-model="messageContent" v-on:keyup.enter.native="chatToUser"></el-input>
</div> <el-button type="primary" class="chatBoxSendBtn" size="small" v-on:click="chatToUser">发送</el-button>
</div> </div>
<!--//客服代码--> <!--//客服代码-->
@ -309,9 +310,15 @@
} }
}); });
}, },
initCss(){
$(function () {
$(".chatBox").css("max-height",$(window).height());
});
},
}, },
created: function () { created: function () {
this.initCss();
this.initConn(); this.initConn();
//加载历史记录 //加载历史记录
this.msgList=this.getHistory(); this.msgList=this.getHistory();

Loading…
Cancel
Save