问题遇到的现象和发生背景
随机数的机制
现在希望点击确认后重新刷新random的值
问题相关代码,请勿粘贴截图
var random = Math.floor(Math.random() * 10);
var context = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"];
Page({
showModal(){
wx.showModal({
title: '选项A',
content: context[random],
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
}else{
console.log('用户点击取消')
}
},
})
},
})