用u-view写的uni-app常用的表单形式精品分析

在这里插入图片描述
首先我们看效果图

<template>
	<view class="container">
		<view class="header ">
			<view class="box">
				<label>姓名</label>
				<text class="color">*</text>
			</view>
			<view class="u-input">
				<input type="text" placeholder="请输入姓名" maxlength="10" placeholder-style="color: #B1B1B1" />
			</view>
		</view>
		<view class="header ">
			<view class="box">
				<label>身份证号</label>
				<text class="color">*</text>
			</view>
			<view class="u-input">
				<input type="text" placeholder="请输入身份证号" maxlength="18" placeholder-style="color: #B1B1B1" />
			</view>
		</view>
		<view class="header ">
			<view class="box">
				<label>手机号</label>
				<text class="color">*</text>
			</view>
			<view class="u-input">
				<input type="text" placeholder="请输入手机号" maxlength="11" placeholder-style="color: #B1B1B1" />
			</view>
		</view>
		<view class="header ">
			<view class="box">
				<label>所在地区</label>
				<text class="color">*</text>
			</view>
			<view class="city" @click="show = true">
				<!-- 通过判断address里面是否有值来判定显示和隐藏 -->
				<text  v-if="address===''?true:false">请选择所在地区</text>
				<text style="color:#333333">{{address}}</text>
				<u-picker v-model="show" mode="region" @confirm="confirm"></u-picker>
			</view>
			<view class="row">
				<image src="../../static/rightrow.png" mode=""></image>
			</view>
		</view>
		<view class="header ">
			<view class="box">
				<label>经营地址</label>
				<text class="color">*</text>
			</view>
			<view class="u-input">
				<input type="text" placeholder="请输入经营地址" placeholder-style="color: #B1B1B1" />
			</view>
		</view>
		<view class="header ">
			<view class="box">
				<label>位置</label>
				<text class="color">*</text>
			</view>
			<view class="u-input">
				<input type="text" placeholder="请选择" />
			</view>
			<view class="row">
				<image src="../../static/rightrow.png" mode=""></image>
			</view>
		</view>
		<view class="header ">
			<view class="box">
				<label>推荐人手机号</label>
			</view>
			<view class="u-input">
				<input type="text" placeholder="请输入推荐人手机号" maxlength="11" placeholder-style="color: #B1B1B1" />
			</view>
		</view>
		<view class="apply">
			<view class="toapply">
				申请成为商户
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				address:'',
			}
		},
		methods: {
			confirm(e) {
				// 点击后获取省市区展现到页面
				this. address=`${e.province.label+e.city.label+e.area.label}`	
			}
		}
	}
</script>

<style lang="scss" scoped>
	.header {
		width: 100%;
		height: 120rpx;
		padding: 0 32rpx;
		display: flex;
		flex-direction: row;

		.city {
			flex: 1;
			height: 100%;
			line-height: 120rpx;
			text-align: right;
			color: #B1B1B1;
			border-bottom: 1rpx solid #E4E4E4;
		}

		.row {
			position: relative;
			top: 50%;
			right: 0;
			transform: translateY(-50%);
			width: 24rpx;
			height: 24rpx;
			font-size: 0;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.box {
			width: 180rpx;
			height: 100%;
			border-bottom: 1rpx solid #E4E4E4;
			line-height: 120rpx;

			label {
				font-size: 30rpx;
				font-weight: 400;
				color: #333333;
				line-height: 42px;
			}

			.color {
				color: #FC5C56;
			}
		}

		.u-input {
			border-bottom: 1rpx solid #E4E4E4;
			color: #333333;
			flex: 1;
			line-height: 120rpx;
			text-align: right;

			input {
				width: 100%;
				height: 100%;
			}

		}
	}

	.apply {
		width: 100%;
		margin-top: 49rpx;
		height: 90rpx;
		padding: 0 33rpx;
		text-align: center;

		.toapply {
			width: 100%;
			height: 100%;
			background-color: green;
			line-height: 90rpx;
			background-color: #337DFF;
			font-size: 36prx;
			border-radius: 45rpx;
			font-weight: 400;
			color: #FFFFFF;
		}
	}
</style>

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值