国旅手游网提供好玩的手机游戏和手机必备软件下载,每天推荐精品安卓手游和最新应用软件app,并整理了热门游戏攻略、软件教程、资讯等内容。欢迎收藏

当前位置:国旅手游网攻略软件教程内容

微信小程序消息提示框[微信小程序消息提醒功能]优质

725次浏览 | 2023-05-12 17:21:15 更新
提问:南续
最佳经验
回答:初蝶

网友采纳答案

网友南续提问:微信小程序的消息通知页面

本章节主要介绍了如何使用微信小程序的显示消息提示组件?操作起来也比较简单,还不会的朋友一起跟着小编学习一下吧,希望对你们有所帮助。

组件说明:

Toast是当用户点击某些组件时弹出来来的提示消息。Toast会帮助你创建和显示这些消息。Toast是一种简易的消息提示框。当视图显示给用户,在应用程序中显示为浮动。小程序即将废弃Toast组件,故这里介绍Toast的API:wx.showToast

组件用法:

微信小程序消息提示框

wxml

<!--index.wxml-->

<view class="content">

<text class="showfunc">Toast功能</text>

<view class="con-button">

<button class="button-left" bindtap="showToast">展示Toast</button>

<button class="button-right" bindtap="hideToast">隐藏Toast</button>

</view>

</view>

复制代码

js

Page({

showToast:function(){

var that=this;

wx.showToast({

title: \'成功\',

icon: \'success\',

duration: 2000,

success: that.flySuccess,

fail:that.flyFail,

complete:that.flyComplete

})

},

hideToast:function(){

var that=this;

wx.showToast({

title: \'加载中\',

icon: \'loading\',

duration: 10000,

success: that.loadingSuccess,

fail:that.loadingFail,

complete:that.loadingComplete

});

setTimeout(function(){

wx.hideToast()

},2000)

},

flySuccess:function(e){

console.log(e);

console.log("起飞成功!");

},

flyFail:function(e){

console.log(e);

console.log("起飞失败!")

},

flyComplete:function(e){

console.log(e);

console.log("起飞结束!")

},

loadingSuccess:function(e){

console.log(e);

console.log("加载成功!");

},

loadingFail:function(e){

console.log(e);

console.log("加载失败!")

},

loadingComplete:function(e){

console.log(e);

console.log("加载结束!")

}

})

复制代码

wxss

/**index.wxss**/

.con-button{

display: flex;

flex-direction: row;

padding-top: 10%;

}

.showfunc{

padding-top:10%;

display: block;

text-align: center;

color: green;

}

复制代码

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

关于《如何使用微信小程序的显示消息提示组件?》相关问题的解答初蝶小编就为大家介绍到这里了。如需了解其他软件使用问题,请持续关注国旅手游网软件教程栏目。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如果发现本站有涉嫌抄袭侵权/违法违规的内容,欢迎发送邮件至【1047436850@qq.com】举报,并提供相关证据及涉嫌侵权链接,一经查实,本站将在14个工作日内删除涉嫌侵权内容。

本文标题:【微信小程序消息提示框[微信小程序消息提醒功能]】

本文链接:http://www.citshb.com/class222658.html

相关游戏
微信本安卓版
微信本安卓版
  • 类型:社交聊天
  • 大小:256.1M
  • 版本:8.0.49
  • 评分: