当前位置:网站首页>Self made pop-up input box, input text, and click to complete the event.
Self made pop-up input box, input text, and click to complete the event.
2022-07-03 12:16:00 【favoritecode】
Sometimes after clicking an event , Users are required to input text such as reasons , At this time, you need a pop-up box to input text . This is the effect :
wxml:
<view class="reasonBackground" hidden="{
{hidden}}">
<view class="reasonFrame">
<view class="word"> Please enter the reason :</view>
<form bindsubmit="formSubmit" bindreset="cancel" >
<view class="resonFrame">
<textarea name="notGroupGoReason" maxlength="60"/>
<view class="confirmFrame">
<button formType="reset"> take eliminate </button>
<button form-type="submit"> indeed set </button>
</view>
</view>
</form>
</view>
</view>
{ {hidden}} The initial value of true
Page({
data: {
hidden: true
},
onLoad: function (options) {
var that = this
var hidden = that.data.hidden
that.setData({
hidden
})
}
})
Click on notGroupGo Pop up box after pressing key
notGroupGo: function () {
var that = this
that.setData({
hidden: false
})
},
Click OK to leave the page or hide the pop-up frame
formSubmit: function(e){
var notGroupGoReason = e.detail.value.notGroupGoReason
console.log("notGroupGoReason:",notGroupGoReason)
var goodsid = app.globalData.goodsInfo._id
var db = wx.cloud.database()
db.collection('goodsList').doc(goodsid).update({
data: {
state: 3,
notGroupGoReason,
}
})
.then(res => {
wx.showToast({
title: ' complete ',
icon: 'success',
duration: 2000
})
setTimeout(function () {
wx.hideToast()
wx.navigateBack({
delta: 1,
})
}, 1500)
})
.catch(console.error)
}
And cancellation :
cancel:function(){
var that = this
that.setData({
hidden: true
})
},
Pay attention to the use of hiding and displaying , It's best to use animation effects , But I will not , If you can tell me , Thank you very much !
边栏推荐
- wpa_ cli
- 257. All paths of binary tree
- Apprendre à concevoir des entités logicielles réutilisables à partir de la classe, de l'API et du cadre
- Flutter 退出登录二次确认怎么做才更优雅?
- Fluent: Engine Architecture
- Integer string int mutual conversion
- regular expression
- Shutter: about inheritedwidget
- 手机号码变成空号导致亚马逊账号登陆两步验证失败的恢复网址及方法
- shardingSphere分库分表<3>
猜你喜欢
Solve msvcp120d DLL and msvcr120d DLL missing
2.8 overview of ViewModel knowledge
实现验证码验证
Colleagues wrote a responsibility chain model, with countless bugs
Quantitative calculation research
OPenGL 基本知识(根据自己理解整理)
PHP導出word方法(一mht)
[official MySQL document] deadlock
[learning notes] DP status and transfer
vulnhub之Nagini
随机推荐
wpa_ cli
(construction notes) ADT and OOP
win10 上PHP artisan storage:link 出现 symlink (): Protocol error的解决办法
Deploying WordPress instance tutorial under coreos
Qt OpenGL相机的使用
Basic knowledge of OpenGL (sort it out according to your own understanding)
Dart: About zone
2.8 overview of ViewModel knowledge
OpenGL 着色器使用
Optimize interface performance
257. All paths of binary tree
Oracle advanced (I) realize DMP by expdp impdp command
(构造笔记)从类、API、框架三个层面学习如何设计可复用软件实体的具体技术
Atomic atomic operation
Shell: basic learning
Integer int compare size
使用BLoC 构建 Flutter的页面实例
QT OpenGL rotate, pan, zoom
Wechat applet development - page Jump transfer parameters
347. Top k high frequency elements