麻豆做爰免费观看-日本熟妇一区二区三区-欧美午夜精品一区二区-xxxxx国产-精品欧美日韩-五月天黄色小说-亚洲熟妇一区-jizz国产视频-国产91九色-www好男人-国产精品久久久免费-九九热精彩视频-www..com国产-午夜簧片-欧美一区中文字幕-在线观看亚洲一区二区-一级少妇精品久久久久久久-www.欧美国产-日韩欧美综合视频-成人性视频免费网站

027-81331413

微信小程序消息提醒設置

發(fā)布時間:2021-01-02 瀏覽:5988

  微信小程序的開發(fā)要考慮到很多方面的問題,微信小程序消息提示音你知道要怎么設置嗎?其實這和開發(fā)一個微信小程序一樣,也需要代碼。

  做Android的時候對toast是很熟悉的.微信小程序開發(fā)中toast也是重要的消息提示方式.

  提示框:

  wx.showToast(OBJECT)

  顯示消息提示框

  OBJECT參數(shù)說明:

  

微信小程序消息提示音

  小程序代碼:

  ?

  wx.showToast({

  title: '成功',

  icon: 'success',

  duration: 2000

  })

  wx.hideToast()

  隱藏消息提示框

  ?

  wx.showToast({

  title: '加載中',

  icon: 'loading',

  duration: 10000

  })

  setTimeout(function(){

  wx.hideToast()

  },2000)

  wx.showModal(OBJECT)

  顯示模態(tài)彈窗

  OBJECT參數(shù)說明:

  

  示例代碼:

  ?

  wx.showModal({

  title: '提示',

  content: '這是一個模態(tài)彈窗',

  success: function(res) {

  if (res.confirm) {

  console.log('用戶點擊確定')

  }

  }

  })

  wx.showActionSheet(OBJECT)

  顯示操作菜單

  OBJECT參數(shù)說明:

  

  success返回參數(shù)說明:

  

  示例代碼:

  wx.showActionSheet({

  itemList: ['A', 'B', 'C'],

  success: function(res) {

  if (!res.cancel) {

  console.log(res.tapIndex)

  }

  }

  })

  設置不同的小程序導航條

  wx.setNavigationBarTitle(OBJECT)

  動態(tài)設置頁面的標題。

  OBJECT參數(shù)說明:

  

  示例代碼:

  setNavigationBarTitle({

  title: '當前頁面'

  })

  wx.showNavigationBarLoading()

  在當前頁面顯示導航條加載動畫。

  wx.hideNavigationBarLoading()

  隱藏導航條加載動畫。

  頁面跳轉:

  wx.navigateTo(OBJECT)

  保留當前頁面,跳轉到應用內(nèi)的某個頁面,使用wx.navigateBack可以返回到原頁面。

  OBJECT參數(shù)說明:

  

微信消息提示音

  示例代碼:

  wx.navigateTo({

  url: 'test?id=1'

  })

  ?

  //test.js

  Page({

  onLoad: function(option){

  console.log(option.query)

  }

  })

  注意:為了不讓用戶在使用小程序時造成困擾,我們規(guī)定頁面路徑只能是五層,請盡量避免多層級的交互方式。

  wx.redirectTo(OBJECT)

  關閉當前頁面,跳轉到應用內(nèi)的某個頁面。

  OBJECT參數(shù)說明:

  

微信小程序消息提示音

  示例代碼:

  wx.redirectTo({

  url: 'test?id=1'

  })

  wx.navigateBack(OBJECT)

  關閉當前頁面,返回上一頁面或多級頁面??赏ㄟ^ getCurrentPages()) 獲取當前的頁面棧,決定需要返回幾層。

  OBJECT參數(shù)說明:

  

設置小程序消息提示音

  動畫:

  wx.createAnimation(OBJECT)

  創(chuàng)建一個動畫實例animation。調(diào)用實例的方法來描述動畫。最后通過動畫實例的export方法導出動畫數(shù)據(jù)傳遞給組件的animation屬性。

  注意: export 方法每次調(diào)用后會清掉之前的動畫操作

  OBJECT參數(shù)說明:

  

消息提示音

  var animation = wx.createAnimation({

  transformOrigin: "50% 50%",

  duration: 1000,

  timingFunction: "ease",

  delay: 0

  })

  animation

  動畫實例可以調(diào)用以下方法來描述動畫,調(diào)用結束后會返回自身,支持鏈式調(diào)用的寫法。

  樣式:

  

怎么設置微信小程序消息提示音

  旋轉:

  

微信小程序消息提示音設置

  縮放:

  

微信小程序消息提示

  偏移:

  

微信小程序提示音

  傾斜:

  

小程序消息提示音

  矩陣變形:

  

微信小程序消息提示音

  動畫隊列

  調(diào)用動畫操作方法后要調(diào)用 step() 來表示一組動畫完成,可以在一組動畫中調(diào)用任意多個動畫方法,一組動畫中的所有動畫會同時開始,一組動畫完成后才會進行下一組動畫。step 可以傳入一個跟 wx.createAnimation() 一樣的配置參數(shù)用于指定當前組動畫的配置。

  示例:

  Page({

  data: {

  animationData: {}

  },

  onShow: function(){

  var animation = wx.createAnimation({

  duration: 1000,

  timingFunction: 'ease',

  })

  this.animation = animation

  animation.scale(2,2).rotate(45).step()

  this.setData({

  animationData:animation.export()

  })

  setTimeout(function() {

  animation.translate(30).step()

  this.setData({

  animationData:animation.export()

  })

  }.bind(this), 1000)

  },

  rotateAndScale: function () {

  // 旋轉同時放大

  this.animation.rotate(45).scale(2, 2).step()

  this.setData({

  animationData: this.animation.export()

  })

  },

  rotateThenScale: function () {

  // 先旋轉后放大

  this.animation.rotate(45).step()

  this.animation.scale(2, 2).step()

  this.setData({

  animationData: this.animation.export()

  })

  },

  rotateAndScaleThenTranslate: function () {

  // 先旋轉同時放大,然后平移

  this.animation.rotate(45).scale(2, 2).step()

  this.animation.translate(100, 100).step({ duration: 1000 })

  this.setData({

  animationData: this.animation.export()

  })

  }

  })

  wx.hideKeyboard()

  收起鍵盤。

  wx.stopPullDownRefresh()

  停止當前頁面下拉刷新。詳見 頁面相關小程序事件處理函數(shù)。