wxml:
- <form bindsubmit="formsubmit">
- <view style="width: 90%;display: flex;margin-left: 5%;">
- <view class="text1">昵称:view>
- <input style="width: 150px;margin-left: 30px;margin-top: 30px;" type="nickname" placeholder="请输入昵称" name="nickname" />
- view>
- form>
js
- // 昵称
- formsubmit(e) {
- const nickName = e.detail.value.nickname
- console.log("nickName", nickName)
- // do something
- },
效果: