微信小程序 自定義對(duì)話框?qū)嵗斀?/h1>
更新時(shí)間:2017年01月20日 17:16:20 投稿:lqh
這篇文章主要介紹了微信小程序 自定義對(duì)話框?qū)嵗斀獾南嚓P(guān)資料,這里附有實(shí)例代碼及實(shí)現(xiàn)效果圖,需要的朋友可以參考下
微信小程序 自定義對(duì)話框?qū)嵗斀?/strong>
效果圖:

index.wxml:
<button type="default" bindtap="clickbtn">
點(diǎn)擊
</button>
<view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view>
<view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}">
<!--對(duì)話框標(biāo)題-->
<view class="dialog-title">
請(qǐng)輸入內(nèi)容
</view>
<!--對(duì)話框輸入部分-->
<view class="input-view">
<input type="text" bindblur="input_content" class="input-style"/>
</view>
<!--對(duì)話框按鈕-->
<view class="line-top">
</view>
<view class="btn-view">
<view class="btn-cancel" bindtap="click_cancel">
取 消
</view>
<view class="btn-line">
</view>
<view class="btn-cancel" bindtap="click_ok">
確 定
</view>
</view>
</view>
index.js:
var inputinfo = "";
var app = getApp()
Page({
data: {
animationData:"",
showModalStatus:false
},
onLoad: function () {
},
showModal: function () {
// 顯示遮罩層
var animation = wx.createAnimation({
duration: 200,
timingFunction: "linear",
delay: 0
})
this.animation = animation
animation.translateY(300).step()
this.setData({
animationData: animation.export(),
showModalStatus: true
})
setTimeout(function () {
animation.translateY(0).step()
this.setData({
animationData: animation.export()
})
}.bind(this), 200)
},
clickbtn:function(){
if(this.data.showModalStatus){
this.hideModal();
}else{
this.showModal();
}
},
hideModal: function () {
// 隱藏遮罩層
var animation = wx.createAnimation({
duration: 200,
timingFunction: "linear",
delay: 0
})
this.animation = animation
animation.translateY(300).step()
this.setData({
animationData: animation.export(),
})
setTimeout(function () {
animation.translateY(0).step()
this.setData({
animationData: animation.export(),
showModalStatus: false
})
}.bind(this), 200)
},
click_cancel:function(){
console.log("點(diǎn)擊取消");
this.hideModal();
},
click_ok:function(){
console.log("點(diǎn)擊了確定===,輸入的信息為為==",inputinfo);
this.hideModal();
},
input_content:function(e){
console.log(e);
inputinfo = e.detail.value;
}
})
源碼下載:http://xiazai.jb51.net/201701/yuanma/modalTest(jb51.net).rar
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
您可能感興趣的文章:- 微信小程序自定義底部彈出框
- JS中微信小程序自定義底部彈出框
- 微信小程序 自定義消息提示框
- 微信小程序自定義對(duì)話框彈出和隱藏動(dòng)畫(huà)
- 微信小程序開(kāi)發(fā)之實(shí)現(xiàn)自定義Toast彈框
- 如何自定義微信小程序tabbar上邊框的顏色
- 微信小程序自定義select下拉選項(xiàng)框組件的實(shí)現(xiàn)代碼
- 微信小程序自定義模態(tài)對(duì)話框?qū)嵗斀?/a>
- 微信小程序 自定義復(fù)選框?qū)崿F(xiàn)代碼實(shí)例
- 微信小程序?qū)崿F(xiàn)自定義動(dòng)畫(huà)彈框/提示框的方法實(shí)例
相關(guān)文章
-
微信小程序 支付后臺(tái)java實(shí)現(xiàn)實(shí)例
這篇文章主要介紹了微信小程序 支付后臺(tái)java實(shí)現(xiàn)實(shí)例的相關(guān)資料,需要的朋友可以參考下 2017-05-05
-
Parcel配置public靜態(tài)文件目錄過(guò)程解析
這篇文章主要為大家介紹了Parcel配置public靜態(tài)文件目錄實(shí)現(xiàn)過(guò)程解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪 2023-06-06
-
JS實(shí)現(xiàn)大數(shù)相加大數(shù)相乘示例詳解
這篇文章主要為大家介紹了JS實(shí)現(xiàn)大數(shù)相加大數(shù)相乘示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪 2022-08-08
-
利用前端HTML+CSS+JS開(kāi)發(fā)簡(jiǎn)單的TODOLIST功能(記事本)
這篇文章主要介紹了用HTML+CSS+JS做出簡(jiǎn)單的TODOLIST(記事本)項(xiàng)目,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下 2021-04-04
-
前端面試必會(huì)網(wǎng)絡(luò)跨域問(wèn)題解決方法
這篇文章主要為大家介紹了前端面試必會(huì)的網(wǎng)絡(luò)跨域問(wèn)題解決方法講解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪 2022-07-07
-
TypeScript5.2引入新關(guān)鍵字using介紹
這篇文章主要介紹了TypeScript5.2引入新關(guān)鍵字using使用詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪 2023-06-06
最新評(píng)論
微信小程序 自定義對(duì)話框?qū)嵗斀?/strong>
效果圖:
index.wxml:
<button type="default" bindtap="clickbtn"> 點(diǎn)擊 </button> <view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view> <view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}"> <!--對(duì)話框標(biāo)題--> <view class="dialog-title"> 請(qǐng)輸入內(nèi)容 </view> <!--對(duì)話框輸入部分--> <view class="input-view"> <input type="text" bindblur="input_content" class="input-style"/> </view> <!--對(duì)話框按鈕--> <view class="line-top"> </view> <view class="btn-view"> <view class="btn-cancel" bindtap="click_cancel"> 取 消 </view> <view class="btn-line"> </view> <view class="btn-cancel" bindtap="click_ok"> 確 定 </view> </view> </view>
index.js:
var inputinfo = ""; var app = getApp() Page({ data: { animationData:"", showModalStatus:false }, onLoad: function () { }, showModal: function () { // 顯示遮罩層 var animation = wx.createAnimation({ duration: 200, timingFunction: "linear", delay: 0 }) this.animation = animation animation.translateY(300).step() this.setData({ animationData: animation.export(), showModalStatus: true }) setTimeout(function () { animation.translateY(0).step() this.setData({ animationData: animation.export() }) }.bind(this), 200) }, clickbtn:function(){ if(this.data.showModalStatus){ this.hideModal(); }else{ this.showModal(); } }, hideModal: function () { // 隱藏遮罩層 var animation = wx.createAnimation({ duration: 200, timingFunction: "linear", delay: 0 }) this.animation = animation animation.translateY(300).step() this.setData({ animationData: animation.export(), }) setTimeout(function () { animation.translateY(0).step() this.setData({ animationData: animation.export(), showModalStatus: false }) }.bind(this), 200) }, click_cancel:function(){ console.log("點(diǎn)擊取消"); this.hideModal(); }, click_ok:function(){ console.log("點(diǎn)擊了確定===,輸入的信息為為==",inputinfo); this.hideModal(); }, input_content:function(e){ console.log(e); inputinfo = e.detail.value; } })
源碼下載:http://xiazai.jb51.net/201701/yuanma/modalTest(jb51.net).rar
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
- 微信小程序自定義底部彈出框
- JS中微信小程序自定義底部彈出框
- 微信小程序 自定義消息提示框
- 微信小程序自定義對(duì)話框彈出和隱藏動(dòng)畫(huà)
- 微信小程序開(kāi)發(fā)之實(shí)現(xiàn)自定義Toast彈框
- 如何自定義微信小程序tabbar上邊框的顏色
- 微信小程序自定義select下拉選項(xiàng)框組件的實(shí)現(xiàn)代碼
- 微信小程序自定義模態(tài)對(duì)話框?qū)嵗斀?/a>
- 微信小程序 自定義復(fù)選框?qū)崿F(xiàn)代碼實(shí)例
- 微信小程序?qū)崿F(xiàn)自定義動(dòng)畫(huà)彈框/提示框的方法實(shí)例
相關(guān)文章
微信小程序 支付后臺(tái)java實(shí)現(xiàn)實(shí)例
這篇文章主要介紹了微信小程序 支付后臺(tái)java實(shí)現(xiàn)實(shí)例的相關(guān)資料,需要的朋友可以參考下2017-05-05Parcel配置public靜態(tài)文件目錄過(guò)程解析
這篇文章主要為大家介紹了Parcel配置public靜態(tài)文件目錄實(shí)現(xiàn)過(guò)程解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-06-06JS實(shí)現(xiàn)大數(shù)相加大數(shù)相乘示例詳解
這篇文章主要為大家介紹了JS實(shí)現(xiàn)大數(shù)相加大數(shù)相乘示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-08-08利用前端HTML+CSS+JS開(kāi)發(fā)簡(jiǎn)單的TODOLIST功能(記事本)
這篇文章主要介紹了用HTML+CSS+JS做出簡(jiǎn)單的TODOLIST(記事本)項(xiàng)目,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2021-04-04前端面試必會(huì)網(wǎng)絡(luò)跨域問(wèn)題解決方法
這篇文章主要為大家介紹了前端面試必會(huì)的網(wǎng)絡(luò)跨域問(wèn)題解決方法講解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-07-07TypeScript5.2引入新關(guān)鍵字using介紹
這篇文章主要介紹了TypeScript5.2引入新關(guān)鍵字using使用詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-06-06