欧美三级国产三级日韩三级_亚洲熟妇丰满大屁股熟妇_欧美亚洲成人一区二区三区_国产精品久久久久久模特

左側彈出菜單欄目【小程序】 - 新聞資訊 - 云南小程序開發(fā)|云南軟件開發(fā)|云南網(wǎng)站建設-昆明葵宇信息科技有限公司

159-8711-8523

云南網(wǎng)建設/小程序開發(fā)/軟件開發(fā)

知識

不管是網(wǎng)站,軟件還是小程序,都要直接或間接能為您產(chǎn)生價值,我們在追求其視覺表現(xiàn)的同時,更側重于功能的便捷,營銷的便利,運營的高效,讓網(wǎng)站成為營銷工具,讓軟件能切實提升企業(yè)內(nèi)部管理水平和效率。優(yōu)秀的程序為后期升級提供便捷的支持!

您當前位置>首頁 » 新聞資訊 » 小程序相關 >

左側彈出菜單欄目【小程序】

發(fā)表時間:2020-10-19

發(fā)布人:葵宇科技

瀏覽次數(shù):47

想法

不想使用第三方的小程序UI組件,理由是因為第三方組件是所有常見組件的集合,css樣式代碼過于龐大,雖然說是輕量級的組件,但是對于小程序來說,依舊很龐大。并且在一個小程序中也不一定用到所有的組件,卻是引入全部的css代碼。

所以我想將每一個組件單獨剝離出來,當使用到某一個組件的時候,就引入對應的組件和樣式即可。

效果圖:

在這里插入圖片描述

思路和上一篇文章:微信小程序UI組件:底部彈出【pop-up】

源碼:

<!-- 陰影 -->

<view class="yd_overlay  {{show?'yd_show_overlay':'yd_close_overlay'}}" bindtap="close_overlay"></view>

<!-- 左側欄目 -->
<view bindtap="close_overlay" class="left_container  {{show?'yd_left_content':'yd_close_overlay'}}">左側欄目</view>

css:

.yd_overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.yd_show_overlay {
  width: 100%;
  transition-property: width;
  transition-duration: 900ms;
  transition-timing-function: ease;
}

.yd_close_overlay {
  width: 0;
  transition-property: width;
  transition-duration: 900ms;
  transition-timing-function: ease;
}

.left_container {
  position: fixed;
  top: 0;
  bottom: 0;
  height: 100%;
  background: red;
  z-index: 999;
  overflow: hidden;
}

.yd_left_content {
  width: 20%;
  transition-property: width;
  transition-duration: 900ms;
  transition-timing-function: ease;
}

js:

Component({
  properties: {
    show: Boolean,
  },
  data: {},
  attached: function(e) {},
  methods: {
    close_overlay() {
      this.setData({
        show: false
      })
    },
    pop_left() {
      this.setData({
        show: true
      })
    }
  },
})

以上代碼已經(jīng)將組件編寫好了,在其他頁面使用的時候,在json文件中直接引入即可:

{
  "usingComponents": {
    "popup-left":"../Components/popupLeft/popupLeft"
  }
}

wxml:

  <!-- 引入組件 -->
  <popup-left show="{{showleft}}"></popup-left>

show就是主頁面向組件傳遞的參數(shù)。

如有誤,歡飲留言!!!!

相關案例查看更多