uniapp聊天页面

阅读 86

2022-10-24

<template>
<view>
<!-- <view style="border-bottom: 5rpx solid blue;" v-bind:style="{ height: vhei + 'px' }"> -->
<view>
<view class="" v-for="item in list">
<!-- <view class=""
style="display: flex;flex-direction: row;padding-left: 20rpx;padding-right: 20rpx;padding-top: 20rpx;">
<view class="" style="padding-right: 10rpx;">
<u-avatar text="北" fontSize="18" randomBgColor></u-avatar>
</view>
<view class="" style="display: flex;justify-content: center;">{{item}}</view>
</view> -->
<view class=""
style="display: flex;flex-direction:row-reverse;padding-left: 20rpx;padding-right: 20rpx;padding-top: 20rpx;">
<view class="" style="padding-left: 20rpx;height: 100rpx;background-color: aqua;width: 80rpx;">
</view>
<view class="" style="display: flex;justify-content: center;padding-right: 20rpx;">
<image :src="item" mode="aspectFit"></image>
</view>
</view>
</view>
</view>
<view class="" style="height: 120rpx;"></view>
<view class="" style="flex-direction: row;position: fixed;display: flex;" :style="{bottom: btt+'rpx'}">
<view class=""><input class="uni-input" type="text"
style="height: 80rpx;background-color: #FFFFFF;padding-left: 10rpx;width: 500rpx;"
@input="onKeyInput" clear @keyboardheightchange="khc" /></view>
<view class="">
<button type="primary" style="width: 150rpx;height: 80rpx;" @touchend.prevent="fasong()">发送</button>
</view>
<view class="">
<image src="../../static/logo.png" mode="" style="width: 80rpx;height: 80rpx;" @click="bq"></image>
</view>
</view>
<!-- 表情 -->
<view class="" v-if="biaoqing">
<image src="../../static/logo.png" mode="" style="height: 200rpx;"></image>
</view>
</view>
</template>

<script>
let _this
export default {
data() {
return {
list: [
'https://bbs.qn.img-space.com/202104/11/629447fe4d831e74ea0a4cf144b00246.jpg?imageView2/2/w/1024/q/100/ignore-error/1/',
'https://bbs.qn.img-space.com/202104/11/629447fe4d831e74ea0a4cf144b00246.jpg?imageView2/2/w/1024/q/100/ignore-error/1/',
'https://bbs.qn.img-space.com/202104/11/629447fe4d831e74ea0a4cf144b00246.jpg?imageView2/2/w/1024/q/100/ignore-error/1/',
'https://bbs.qn.img-space.com/202104/11/8f5f9b60a0dedff88211f991e7a28c04.jpg?imageView2/2/w/1024/q/100/ignore-error/1/',
'https://bbs.qn.img-space.com/202104/11/8f5f9b60a0dedff88211f991e7a28c04.jpg?imageView2/2/w/1024/q/100/ignore-error/1/',
'https://bbs.qn.img-space.com/202104/11/8f5f9b60a0dedff88211f991e7a28c04.jpg?imageView2/2/w/1024/q/100/ignore-error/1/',
'https://bbs.qn.img-space.com/202104/11/8f5f9b60a0dedff88211f991e7a28c04.jpg?imageView2/2/w/1024/q/100/ignore-error/1/',
'https://bbs.qn.img-space.com/202104/11/8f5f9b60a0dedff88211f991e7a28c04.jpg?imageView2/2/w/1024/q/100/ignore-error/1/',
],
vhei: 0,
inputValue: '',
biaoqing:false,
btt:0
}
},
onShow() {
console.log("======show==========")
// this.neironggaodu()

},
onLoad() {

_this = this

},
onReady() {
uni.pageScrollTo({
scrollTop: 99999,
duration: 0
});
// setTimeout(() => {
// uni.pageScrollTo({scrollTop: 99999, duration: 0});
// console.log("======pageScrollTo===99=====")
// }, 2000);
},
methods: {
bq(){
console.log("======biaoqing==========")
this.btt=200
this.biaoqing=true
setTimeout(() => {
uni.pageScrollTo({
scrollTop: 99999,
duration: 100
});
}, 50);

},
khc(e) {
console.log("======khc=====", e.detail)
uni.pageScrollTo({
scrollTop: 99999,
duration: 0
});
},
neironggaodu() {
uni.getSystemInfo({
success(sys) {
console.log(sys.windowHeight)
_this.vhei = sys.windowHeight
console.log(_this.vhei)
},
fail(f) {
console.log(f)
}
})
},
onKeyInput: function(event) {

console.log(event.detail.value)
this.inputValue = event.detail.value
},
fasong() {
this.list.push('https://bbs.qn.img-space.com/202104/11/0b5172e80530bb51fcedf9eeaae1182d.jpg?imageView2/2/w/1024')
setTimeout(() => {
uni.pageScrollTo({
scrollTop: 99999,
duration: 100
});
}, 50);


// this.list.push(this.inputValue)
},
}
}
</script>

<style>
page {
background-color: antiquewhite;
}
</style>

精彩评论(0)

0 0 举报