解决安卓app聊天页面点击发送按钮后键盘收起的问题,实现键盘常驻
用两个input,获取焦点实现键盘常驻,直接给项目的代码给搬过来了,有什么不懂可以私信我

	<view class="footer-center" :style="{width:tex+'%'}">
	//内容输入框
		<textarea cursor-spacing="10" class="input-text uni-input"  auto-height :focus="softfocus" maxlength="120" @blur="softblur" @focus="msgfocus" v-model="inputValue" @input="inputchange" />
	</view>
	<!-- 安卓 -->
	<view>
		<view v-show="sendflag==false" class="footer-right1" @tap="showmenu" :style="{width:btn+'%'}">
		    //图片控制的是按钮和加号图片的切换  可忽略
			<image v-if="menucheck == false" style="width: 52upx;height: 52upx;margin:auto;margin-top: 15%;" src="../../../static/infomenu.png" mode=""></image>
			<image v-if="menucheck == true" style="width: 52upx;height: 52upx;margin:auto;margin-top: 15%;" src="../../../static/infomenucheck.png" mode=""></image>
		</view>
		//此处input是个按钮
		<input class="send-btn1" :style="{width:btnwd+'%'}" v-show="sendflags==true" maxlength="0" @blur="sendblur" @focus="sendfocus" @tap="sendMessge" type="text" placeholder="发送" placeholder-style="color:#fff"/>
	</view>

//JS代码
sendfocus:function(){
	var that=this;
	that.sendblur();
},
sendblur:function(){
	var that=this;
	that.softfocus = true;
},
//css代码
.send-btn1{
		position: absolute;
		right: 3%;
		top: 30upx;
		outline: none;
		color: transparent;
		caret-color: rgba(0, 0, 0, 0);
		/* width: 104upx; */
		height: 68upx;
		line-height: 68upx;
		text-align: center;
		background-image: linear-gradient(#387aff, #1440e6);
		color:#fff;
		border-radius: 6px;
		margin:auto;
		font-size: 28upx;
	}
	.footer-right1{
		display: flex;
		justify-content: center;
		align-items: center;
		color: #2878ff;
		z-index: 9;
		position: absolute;
		right: 0;
		background: #fff;
		height:70%;
	}
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐