文章来源:网络作者:静谧发布时间:2026-08-19 02:10:59
这篇文章是教大家如何使用微信小程序的提示框?教程简单易学,有需要的小伙伴就赶紧和小编一起来学习一下吧。
比较简单 直接上码

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)
})
复制代码
以上就是如何使用微信小程序的提示框的全部内容了,大家都学会了吗?

禁地之战(乾马金龙专属)
超变传奇996传奇
乾马金龙专属 全新三职业神器,上线领豪礼,爽玩!

王者霸业(王斩切割爆爆爆)
超变传奇
王斩切割爆爆爆 上线即送自动拾取、自动回收

烈焰之怒(骷髅超变日送10万...
超变传奇996传奇
骷髅超变日送10万 上线免费送刀刀绿毒刀刀冰冻自动回收,无条件登录就送10万充值货币!

铸兵之王(百亿直购送充爆)
超变传奇996传奇
百亿直购送充爆 自动拾取 自动回收 攻速全满 直升10000级 六大终极装备

江湖我最牛(GM狂送真充超超...
超变传奇996传奇
GM狂送真充超超变 全新超变几率触发GM手机,狂送真充红包

斗转武林(竹火百锻默爆)
超变传奇996传奇
竹火百锻默爆 上线福利:自动拾取、自动回收、更多豪礼在线相送!!

战影破穹(百亿送充神技觉醒...
超变传奇996传奇
百亿送充神技觉醒 上线即送自动回收、自动拾取等!

苍穹之剑2(帝煞古兵专属)
超变传奇996传奇
帝煞古兵专属 上线即送自动拾取、自动回收

摸金之路(无限超变天天送百...
超变传奇996传奇
无限超变天天送百万 超爽直购币白漂版本,天天送百万直购币!

国战来了(3.5折免费版)
策略
3.5折免费版 3.5折免费,每天送100限时代金券

《逆战:未来》张杰福利放送:杰...