微信小程序-常用弹窗
1.小程序开发概述2.创建第一个小程序3.微信小程序app.json文件4.微信小程序-sitemap.json文件5.微信小程序app.js文件6.微信小程序app.wxss文件7.微信小程序-project.config.json文件8.微信小程序-页面.json文件9.微信小程序-页面.js文件10.微信小程序-组件创建和使用11.微信小程序-组件-.json文件12.微信小程序-组件-.js文件13.微信小程序-WXSS学什么14.微信小程序-WXSS的书写格式15.微信小程序-新增RPX响应式单位16.微信小程序-什么是WXML17.微信小程序-WXML数据绑定18.微信小程序-WXML条件渲染19.微信小程序-WXML的hidden属性20.微信小程序-WXML列表渲染21.微信小程序-WXML列表渲染Key22.微信小程序-WXML包装元素23.微信小程序-WXS的作用和使用24.微信小程序-WXS独立文件25.微信小程序-WXS支持的语法26.微信小程序-小程序事件绑定27.微信小程序-小程序事件冒泡和事件捕获28.微信小程序-事件传递数据29.微信小程序-data和mark30.微信小程序-touches和changedTouches31.微信小程序-案例练习32.微信小程序-view组件33.微信小程序-text组件34.微信小程序-icon组件35.微信小程序-button组件36.微信小程序-image组件37.微信小程序-scrollview38.微信小程序-image组件-选择相册资源案例39.微信小程序-自定义组件40.微信小程序-自定义组件样式隔离41.微信小程序-自定义组件外部样式42.微信小程序-传递数据父传子43.微信小程序-传递数据子传父44.微信小程序-页面访问组件数据和方法45.微信小程序-组件通讯练习46.微信小程序-单个插槽47.微信小程序-多个插槽-具名插槽48.微信小程序-behaviors49.微信小程序-双线程渲染模型50.微信小程序-页面生命周期51.微信小程序-页面生命周期方法52.微信小程序-组件生命周期方法53.微信小程序-应用程序生命周期方法54.微信小程序-页面跳转Tabbar55.微信小程序-页面跳转navigator组件56.微信小程序-页面跳转wxAPI57.微信小程序-页面跳转数据传递
58.微信小程序-常用弹窗
59.微信小程序-Storage60.微信小程序-获取用户位置官方文档:https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html
showToast
showModal
showLoading
showActionSheet
页面结构文件:
<!--index.wxml-->
<button bindtap="onShowToast">showToast</button>
<button bindtap="onShowLoading">showLoading</button>
<button bindtap="onShowModal">showModal</button>
<button bindtap="onShowActionSheet">showActionSheet</button>
JS 逻辑文件:
// index.js
Page({
onShowToast() {
wx.showToast({
title: '成功',
icon: "success",
duration: 3000,
mask: true,
success() {
console.log("显示成功");
},
fail() {
console.log("显示失败");
},
complete() {
console.log("complete");
}
})
},
onShowLoading() {
wx.showLoading({
title: '加载中',
})
// 注意点:不会主动消失,其它的和showToast差不多
setTimeout(function () {
wx.hideLoading()
}, 2000)
},
onShowModal() {
wx.showModal({
title: '我是标题',
content: '我是内容',
cancelText: "撤退",
cancelColor: "#00f",
confirmText: "确认",
confirmColor: "#f00",
complete: (res) => {
if (res.cancel) {
console.log('点击了取消按钮');
}
if (res.confirm) {
console.log('点击了确认按钮');
}
}
})
},
onShowActionSheet() {
wx.showActionSheet({
itemList: ["电脑", "手机", "家具"],
itemColor: '#f00',
success (res) {
console.log(res.tapIndex)
},
fail (res) {
console.log(res.errMsg)
console.log("点击了取消");
}
})
}
})
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)