Vueトゥーリンロボット自動復帰
6550 ワード
くだらないことは言わないで、直接コードに行きます
しかし、ちょっとしたバグは、メッセージの返事をするときに最後のメッセージをスクロールする必要があります.
-
{{item.message}}
import $ from 'jquery'
var content = $(".content")
export default{
name:'Kefu',
data() {
return {
// ,
inputValue: '',
//
messageList: []
}
},//
methods: {
chat() {
var _this=this;
// console.log(_this.$refs.charView);
this.messageList.push({
message: this.inputValue,
// , true, false
myself: true
})
// console.log(1);
// console.log(message)
// console.log(this.inputValue);
// ,
$.ajax({
url: 'http://www.tuling123.com/openapi/api',
type: 'post',
data: {
key: 'e5e78db64c3744fda06533e6729737da',
info: this.inputValue,
box:""
},
success: (data) => {
// console.log(data);
this.messageList.push({
message: data.text,
myself: false
});
_this.$refs.charView.scrollTop+=999;
}
})
this.inputValue=""
},
btn1(){
this.$router.go(-1)
},
btn2(){
this.messageList.push({
message: this.inputValue,
// , true, false
myself: true
})
// console.log(1);
// console.log(message)
// console.log(this.inputValue);
// ,
$.ajax({
url: 'http://www.tuling123.com/openapi/api',
type: 'post',
data: {
key: 'e5e78db64c3744fda06533e6729737da',
info: this.inputValue
},
success: (data) => {
// console.log(data);
this.messageList.push({
message: data.text,
myself: false
});
}
})
this.inputValue=""
}
},
mounted() {
this.box=this.$refs.charView;
},
}
しかし、ちょっとしたバグは、メッセージの返事をするときに最後のメッセージをスクロールする必要があります.