1. 程式人生 > >【微信小程式學習筆記】彈窗的兩種姿勢

【微信小程式學習筆記】彈窗的兩種姿勢

  1. 在wxml檔案里布局彈窗,利用條件渲染,在js程式碼裡控制是否顯示

    • wxml

      <view >
      <loading wx:if="{{showLoading}}">載入中</loading>
      </view>
    • js

      data: {
         showLoading:true
      },
      showLoading:function(){
        this.setData({
           showLoading:true
        })
      },
      cancelLoading:function(){
       this.setData({
           showLoading:false
      })

ITDogFire –弓長劍鳴