微信小程序自定義底部彈出框
更新時(shí)間:2020年11月16日 10:07:44 作者:Mr_Sparta
這篇文章主要為大家詳細(xì)介紹了微信小程序自定義底部彈出框,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家分享了微信小程序底部彈出框展示的具體代碼,供大家參考,具體內(nèi)容如下
效果圖:
html
<view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view> <view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}"></view>
CSS
.commodity_screen { width: 100%; height: 100%; position: fixed; top: 0; left: 0; background: #000; opacity: 0.2; overflow: hidden; z-index: 1000; color: #fff; } .commodity_attr_box { width: 100%; overflow: hidden; position: fixed; bottom: 0; left: 0; z-index: 2000; background: #fff; padding-top: 20rpx; }
JS動(dòng)畫樣式
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) }, 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) }
為大家推薦現(xiàn)在關(guān)注度比較高的微信小程序教程一篇:《微信小程序開發(fā)教程》小編為大家精心整理的,希望喜歡。
以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
JavaScript實(shí)現(xiàn)文件下載的14種方法總結(jié)大全
在JavaScript中實(shí)現(xiàn)文件下載的功能可以通過多種方式實(shí)現(xiàn),這篇文章主要給大家介紹了關(guān)于JavaScript實(shí)現(xiàn)文件下載的14種方法,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下2024-07-07Webpack devServer中的 proxy 實(shí)現(xiàn)跨域的解決
這篇文章主要介紹了Webpack devServer中的 proxy 實(shí)現(xiàn)跨域的解決,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-06-06js實(shí)現(xiàn)兼容IE和FF的上下層的移動(dòng)
本來是很簡單的一個(gè)功能,可是一開始弄的時(shí)候,還有IE能實(shí)現(xiàn),F(xiàn)F總是不能實(shí)現(xiàn),在網(wǎng)上看了半天,也沒弄出個(gè)所以然,所以在同事的幫忙下,總算弄出來了,瀏覽器的兼容性考的還是細(xì)節(jié)上面的東西,所有關(guān)于細(xì)節(jié)的,我會(huì)用注釋標(biāo)出來的。2015-05-05