uniapp 发布评论时弹窗(自动弹出系统键盘)

<template>
	<view class="pos-fixed bg-w sub-comments w100 ">

		<u-popup :show="show" mode="bottom" @close="close" @open="open" v-if="show">
			<view class="flex justify-between ai-end padding-sm mb-1 mt-1">

				<view class="com-textarea-box">
					<u--textarea :height="60" :cursorSpacing="100" class="com-textarea" :focus="focus"
						:showConfirmBar="false" v-model="formData" placeholder="友善评论" count autoHeight
						maxlength="300"></u--textarea>
				</view>
				<view class="pb-1 f36 f-w mr-1 " :class="formData!='' ? 'c-red' : 'c-999'" @tap="postComments()">
					发布
				</view>
			</view>
		</u-popup>
		<view class="flex justify-between align-center padding-sm" @tap.stop="showComments()">
			<view class="flex align-center justify-center sub-comments-input">
				<view class="mr-1">
					<u-icon size="22" name="edit-pen-fill"></u-icon>
				</view>
				<view>友善评论...</view>
			</view>
			<view class="flex">
				<text class="iconfont c-999 f48 mr-4">&#xe718;</text>
				<text class="iconfont c-999 f48 mr-2">&#xe719;</text>
			</view>
		</view>


	</view>
</template>

<script>
	export default {
		components: {

		},
		data() {
			return {
				formData: "",
				isPopupComments: false,
				show: false,
				focus: true,//是否自动获取焦点弹出系统键盘
			}
		},
		methods: {
			showComments() {
				this.show = true;

			},

			open() {
				this.show = true;
				console.log('open');
			},
			close() {
				this.show = false
				console.log('close');
			},
			postComments() {
				console.log("发布评论");
				this.formData = "";
				this.show = false;

			},

			blur() {
				this.focus = false
			}


		},
	}
</script>


<style lang="scss">
	.sub-comments {
		left: 0;
		bottom: 0;

		// min-height: 100rpx;
		.sub-comments-input {
			width: 484rpx;
			height: 75rpx;
			background: rgba(51, 51, 51, 0.05);
			border-radius: 35rpx;
			opacity: 1;
			
		}
	}

	.com-textarea-box {
		width: 85%;

		.com-textarea,
		textarea {
			min-height: 200rpx;
			padding: 20rpx;

			background: rgba(51, 51, 51, 0.02);
			color: #000 !important; 
		}
	}
</style>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值