微信小程序-- 提交信息 弹出框(弹窗)

微信小程序-- 提交信息弹出框(弹窗)

<view class="navSm" bindtap="toolNo">
      <image src="../../images/idx4.png" class="mavimg" mode="aspectFit"></image>
      <view class="fonts1">出租信息</view>
    </view>
<view class="mask" wx:if="{{showModalStatus}}" bindtap="colse"></view>
<view class="drawerBox" wx:if="{{showModalStatus}}">
  <image class="close" src="../../images/close.png" bindtap="colse"></image>
  <view class="tits">该功能尚未开发,请留下您的需求,我们会尽快处理</view>
  <view class="phonebox">
    <input class="inputA" type="number" name="mobile" placeholder="请获取" value="{{mobile}}" style="display:block;"
      placeholder-class="placeholder-class" disabled="true" />
    <button open-type="getPhoneNumber" wx:if="{{isSHow}}" class="getphone"
      bindgetphonenumber="getPhoneNumber">获取手机号</button>
  </view>
  <view class="area">
    <textarea bindinput="bindinput" placeholder="请输入建议反馈" style="height:320rpx"
      placeholder-class="placeholder-class " />
    </view>
  <view class="btn btn1" bindtap="submit">确认</view>
</view>
data: {
    showModalStatus: false,
  },
  toolNo: utils.throttle(function () {
    this.setData({
      showModalStatus: true
    })
  }),
  // 关闭弹窗
  colse() {
    this.setData({
      showModalStatus: false,
    })
  },
.mask {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  background: #fff;
  opacity: 0.8;
  overflow: hidden;
}
.drawerBox {
  width: 630rpx;
  height: auto;
  line-height: 40rpx;
  border-radius: 20rpx;
  text-align: center;
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.4);
  padding: 40rpx;
  box-sizing: border-box;
  margin-left: 60rpx;
  position: fixed;
  top: 28%;
  left: 0;
  z-index: 1001;
  background-color: #fff;
}

.close {
  width: 42rpx;
  height: 42rpx;
  float: right;
  overflow: hidden;
}
.tits {
  font-size: 16px;
  text-align: center;
  font-weight: bold;
  width: 100%;
  overflow: hidden;
  margin: 60rpx 0 40rpx 0;
  line-height: 50rpx;
}

.phonebox {
  margin-bottom: 40rpx;
  display: flex;
  align-items: center;
}

.inputA {
  width: 550rpx;
  height: 92rpx;
  line-height: 92rpx;
  border-radius: 60rpx;
  background-color: rgba(255, 255, 255, 100);
  text-align: left;
  border: 1px solid rgba(230, 230, 230, 100);
}

.getphone {
  width: 200rpx;
  height: 68rpx;
  line-height: 68rpx;
  border-radius: 60rpx;
  background-color: rgba(156, 148, 171, 100);
  color: rgba(255, 255, 255, 100);
  font-size: 14px;
  text-align: center;
  margin-left: -220rpx;
  margin-top: 20rpx;
  z-index: 999;
}

.area {
  width: 550rpx;
  line-height: 40rpx;
  border-radius: 40rpx;
  height: 320rpx;
  border: 1px solid rgba(230, 230, 230, 100);
  text-align: left;
  padding: 30rpx;
  box-sizing: border-box;
  margin-bottom: 40rpx;
}

textarea {
  width: 100%;
  text-align: left;
  line-height: 40rpx;
  font-size: 14px;
}

.btn {
  width: 550rpx;
  margin-bottom: 0;
  height: 80rpx;
  line-height: 80rpx;
  border-radius: 30rpx;
  background-color: #200E32;
  color: rgba(255, 255, 255, 100);
  font-size: 14px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 100);
  margin-top: 20rpx;
}

在这里插入图片描述

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 微信小程序中可以使用 wx.showModal 或 wx.prompt 来在当前页面弹出一个弹窗,让用户输入数据。 使用 wx.showModal 时可以设置模态的标题、内容和按钮文字,当用户点击确定或取消按钮时会返回一个对象,其中 confirm 属性表示用户是否点击了确定按钮,cancel 属性表示用户是否点击了取消按钮。 示例: ``` wx.showModal({ title: '提示', content: '这是一个模态弹窗', success (res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } }) ``` wx.prompt 方法可以设置标题和默认值,当用户点击确定或取消按钮时会返回一个对象,其中 confirm 属性表示用户是否点击了确定按钮,cancel 属性表示用户是否点击了取消按钮,value 属性表示用户输入的值。 示例: ``` wx.prompt({ title: '输入', defaultValue: '默认值', success (res) { if (res.confirm) { console.log(res.value) } else if (res.cancel) { console.log('用户点击取消') } } }) ``` 希望这能解决你的问题. ### 回答2: 微信小程序点击按钮在当前页面弹出一个弹窗输入数据的实现可以通过以下步骤完成: 1. 在小程序的wxml文件中定义一个按钮组件,例如: ```html <button bindtap="showPopup">点击弹窗输入数据</button> ``` 2. 在小程序的js文件中编写showPopup函数,该函数用于显示弹窗: ```javascript Page({ showPopup: function () { wx.showModal({ title: '请输入数据', content: '', success: function (res) { if (res.confirm) { console.log('用户点击确定') } } }) }, }) ``` 3. 在showModal函数内,调用微信小程序的showModal方法,该方法可以显示一个模态弹窗。 参数title指定弹窗的标题,content可以设置弹窗的输入中的初始文本内容。 在success回调函数中,可以处理用户点击确定按钮的操作。 以上就是实现微信小程序点击按钮在当前页面弹出一个弹窗输入数据的简单示例。 通过以上代码,我们可以在点击按钮后,弹出一个模态窗口供用户输入数据。用户点击确定按钮后,我们可以在success回调函数中处理用户输入的数据。 ### 回答3: 微信小程序是一种轻量级的应用程序,用户可以在微信内直接使用。其中的按钮是常见的交互元素,用于触发事件。在点击按钮时,在当前页面弹出一个弹窗输入数据的功能可以通过以下步骤实现。 首先,需要在页面中添加一个按钮元素,并为按钮绑定一个点击事件。例如: ```html <button bindtap="showModal">点击我输入数据</button> ``` 接下来,在页面的对应的js文件中,定义一个名为showModal的函数来处理按钮的点击事件,并在该函数中调用微信小程序的API来显示弹窗。例如: ```javascript // pages/index/index.js Page({ showModal: function () { wx.showModal({ title: '请输入数据', content: '这是一个输入', success: function (res) { if (res.confirm) { console.log('用户点击确定') // 在这里可以处理用户输入的数据 } else if (res.cancel) { console.log('用户点击取消') // 可以进行一些取消操作 } } }) } }) ``` 在showModal函数中,我们使用了微信小程序的showModal API,该API可以显示一个模态对话,其中包括一个标题和内容,并提供确定和取消按钮供用户选择。 当用户点击确定按钮时,通过处理success回调函数中的逻辑,可以获取用户在弹窗中输入的数据,并进行相应的处理。当用户点击取消按钮时,可以执行一些取消操作。 通过以上步骤,我们可以实现在微信小程序中,点击按钮,在当前页面弹出一个弹窗输入数据的功能。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值