小程序 api

    // showToast
    wx.showToast({
      title: '点击成功',
      icon: 'success',
      duration: 2000
    })
// showModal wx.showModal({ title: '提示', content: '这是一个模态弹窗', success (res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } })
// showLoading wx.showLoading({ title: '加载中', }) setTimeout(function () { wx.hideLoading() }, 2000)
// showActionSheet wx.showActionSheet({ itemList: ['A', 'B', 'C'], success (res) { console.log(res.tapIndex) }, fail (res) { console.log(res.errMsg) } })
  //showNavgationBarLoading/hideNavgationBarLoading
    wx.showNavigationBarLoading();

    setTimeout(function(){
      wx.hideNavigationBarLoading();
    },2000)

    //setNavigationBarTitle
    wx.setNavigationBarTitle({
      title: '当前页面'
    })

  //showTabBarRedDot
   wx.showTabBarRedDot({
        index: 0,
     })
   //setTabBarBadge
     wx.setTabBarBadge({
        index: 0,
        text: 'text',
     })

动画:

<view animation="{{animation}}">动画</view>

var anim = wx.createAnimation({
    duration: 1000,
    delay: 0,
})
anim.translateX(100).step();//表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画

this.setData({
    animation: anim.export()
})

数据缓存:

wx.setStorage({
   data: "fengbeibei",
   key: 'name',
})
wx.getStorage({
    key: 'name',
    success(res){
      console.log(res)
    }
})
wx.removeStorage({
  key: 'name',
  success (res) {
    console.log(res)
  }
})
wx.clearStorage()

 

posted @ 2020-10-27 19:48  氧化成风  阅读(67)  评论(0编辑  收藏  举报