html部分
<form bindsubmit=‘sub‘> <view class="con"> <view class="con-nr"> <text>联系人</text> <input placeholder="姓名" name="name"></input> </view> <view class="con-nr"> <text>电话</text> <input placeholder="电话" name="telephone"></input> </view> <view class="con-nr"> <text>地址</text> <input placeholder="地址" name="address" value="{{markers[0][‘address‘]}}"></input> </view> <view class="con-nr"> <text>详细地址</text> <input placeholder="详细地址,选填" name="detailedaddress" value=""></input> </view> </view> <button class="sub" form-type=‘submit‘> 确定 </button> </form>
css部分
.con{ line-height:70rpx; } .con view{ width:700rpx; margin-left:30rpx; border-bottom:1px solid #f2f2f2; } .con view text{ font-size: 32rpx; } .con-nr input{ width:500rpx; float:right; font-size:28rpx; height: 70rpx; } .sub{ width:500rpx; line-height:85rpx; text-align:center; margin:50rpx auto; background-color:#1AAD19; border-radius:10rpx; }
js部分
Page({ /** * 页面的初始数据 */ data: { }, sub: function (e) { console.log(e.detail.value) } })