游逗网,重度移动游戏垂直门户!

最新游戏|最新软件|游戏更新|电脑软件|电脑游戏|专题合集|合集排行
您当前位置:首页 > 资讯教程 > 软件教程 >  如何使用微信小程序的提示框?

如何使用微信小程序的提示框?

作者:静谧发布时间:

  这篇文章是教大家如何使用微信小程序提示框?教程简单易学,有需要的小伙伴就赶紧和小编一起来学习一下吧。

  比较简单 直接上码

  Toast框

  提示框

  成功提示

  取消提示

  禁止提示

  文本提示

  复制代码

  js

  const App = getApp()

  Page({

  data: {},

  onLoad() {

  this.$wuxToast = App.wux(this).$wuxToast

  },

  showToast() {

  const _this =this;

  _this.$wuxToast.show({

  type: \'success\',

  timer: 1500,

  color: \'#fff\',

  text: \'已完成\',

  // 成功之后的返回,想当于下面的success

  success: () => console.log(\'已完成\')

  // success: function(){

  // console.log(\'已完成\')

  // }

  })

  },

  showToastCancel() {

  const _this =this;

  _this.$wuxToast.show({

  type: \'cancel\',

  timer: 1500,

  color: \'#fff\',

  text: \'取消操作\',

  success: () => console.log(\'取消操作\')

  })

  },

  showToastErr() {

  const _this =this;

  _this.$wuxToast.show({

  type: \'forbidden\',

  timer: 1500,

  color: \'#fff\',

  text: \'禁止操作\',

  success: () => console.log(\'禁止操作\')

  })

  },

  showToastText() {

  const _this =this;

  _this.$wuxToast.show({

  type: \'text\',

  timer: 1500,

  color: \'#fff\',

  text: \'文本内容\',

  success: () => console.log(\'文本内容\')

  })

  },

  })

  复制代码

  注意点

  在app.js中要引入wxui

  import wux from \'components/wux\'

  App({

  onLaunch() {

  console.log(\'onLaunch\')

  },

  onShow() {

  console.log(\'onShow\')

  },

  onHide() {

  console.log(\'onHide\')

  },

  // 通过scope来引入wux函数

  wux: (scope) => new wux(scope)

  })

  复制代码

  以上就是如何使用微信小程序的提示框的全部内容了,大家都学会了吗?

复制本文链接攻略文章为游逗网所有,未经允许不得转载。
系统教程更多
相关资讯更多
热门资讯更多
  1. 1如何在AutoCAD中选框选图形?在AutoCAD中选框选图形的方法
  2. 2QQ如何使用面对面快传?QQ使用面对面快传的方法
  3. 3怎么使用AutoCAD中的快速标注?
  4. 4如何在会声会影10中插入字幕?
  5. 5微信电脑版如何视频聊天?微信电脑版视频聊天的方法
  6. 6微信电脑版如何无限多开?微信电脑版无限多开的方法
  7. 7微信电脑版撤回消息的具体操作步骤介绍
  8. 8会声会影X7功能优势是什么?会声会影X7功能优势详解
火爆软件榜更多
精选资讯更多
热门专题全部>
热门分类全部>