uniapp简单的消息发送回复框架

<template>
    <view class="content">
        <scroll-view scroll-with-animation="true" style="heig

<template>
	<view class="content">
		<scroll-view scroll-with-animation="true" style="height: 800rpx;" scroll-y="true" :scroll-top="scrollTop">
			<view class="" v-for="(item,index) in pageList1">
				<view style="padding: 20rpx 100rpx 20rpx 40rpx;" class="">
					<view class="" style="padding: 20rpx;background-color: #82848A;border: 1rpx solid red;border-radius: 15rpx;">
						客服:您得这个问题非常严肃
						{{item.content}}
					</view>
				</view>
				<view style="display: flex;flex-direction: row;justify-content: flex-end;" class="" >
					{{item.content1}}
				</view>
			</view>
			<input  placeholder="请输入内容" v-model="value1" style="background-color: #82848A;" type="text"  @input="handleInput"/>
			<view @click="but" class="">
				发送
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageList1:[],
				valueInput:'',
				value1:'',
				scrollTop:0,
				
			}
		},
		computed: {
			
		},
		onReady() {

		},
		onPageScroll : function(e) { //nvue暂不支持滚动监听,可用bindingx代替
		    console.log("滚动距离为:" + e.scrollTop);
		},
		methods: {
			handleInput(e){
				this.valueInput = e.detail.value
				
			},
			but(){
				if(this.valueInput){
					this.pageList1.push({
						content:'大大苏打萨达大苏打实打实的大苏打实打实大啊倒萨大苏打大苏打撒旦',
						content1:this.valueInput,
					})
					this.valueInput = null
					this.value1 = null
					this.$nextTick(function() {
						setTimeout(() => {
							this.scrollTop += 300
						}, 200)
					});
					
				}else{
					uni.showToast({
						position:'bottom',
						icon:'none',
						title:'输入内容不能为空'
					})
					
				}
				
				
				
			}
		}
	}
</script>

<style>

</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值