互联网技术 · 2024年2月14日

微信小程序常见的反转操作

wx.showToast执行之后返回上一个页面

wx.showToast({

title: 提交成功,

icon: success,

duration: 2000,

success() {

setTimeout(() => {

wx.navigateBack({

complete: (res) => {

console.log(res)

},

})

}, 2000)

}

})

小程序数组倒序

var numberArray = [1,2,3]

numberArray .reverse();

注意:使用reverse必须要保证是数组调用而且不能为null、undefined 否则报错

文章来源:田珊珊个人博客

OpenMagic API

Need more than content? Move into the product flow.

If you are here for model access, pricing, developer docs, or the future API console, the dedicated product path now lives on api.openmagic.ai.

登录免费注册