- 有段时间没使用的小程序开发权限被回收?
getLocation权限被回收了,在哪里可以申请找回 [图片]
2023-08-15 - 小程序可以动态渲染数据吗
[图片] 我想动态渲染以上数据 ,先采用随机方式取一个数字,然后加到正确的数字 ,采用这样的动态方式 [代码]rollData: [代码][代码]function[代码][代码](realData, index = 0){[代码][代码] [代码][代码]let roundData, randomData;[代码][代码] [代码][代码]if[代码][代码](index == 0) {[代码][代码] [代码][代码]roundData = [1, 2, 3, 4, 5, 6, 7, 8, 9];[代码][代码] [代码][代码]roundData.splice(roundData.find((item, index) => {[代码][代码] [代码][代码]if[代码] [代码](item === realData[index]) {[代码][代码] [代码][代码]return[代码] [代码]index;[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}), 1)[代码][代码] [代码][代码]randomData = roundData[Math.floor(Math.random() * 9)];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]roundData = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];[代码][代码] [代码][代码]roundData.splice(roundData.find((item, index) => {[代码][代码] [代码][代码]if[代码] [代码](item === realData[index]) {[代码][代码] [代码][代码]return[代码] [代码]index;[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}), 1)[代码][代码] [代码][代码]randomData = roundData[Math.floor(Math.random() * 10)];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]this[代码][代码].rollFunc(randomData, realData, roundData, index)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]rollFunc: [代码][代码]function[代码][代码](randomData, realData, roundData, index) {[代码][代码] [代码][代码]let arrData = `letter[${index}]`;[代码][代码] [代码][代码]console.log(randomData, realData, roundData, index)[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码][arrData]: randomData[代码][代码] [代码][代码]})[代码][代码] [代码][代码]if[代码][代码](randomData == realData[index]) {[代码][代码] [代码][代码]if[代码][代码](++index === (realData.length-1)) {[代码][代码] [代码][代码]console.log(33333)[代码][代码] [代码][代码]return[代码][代码];[代码][代码] [代码][代码]}[代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]this[代码][代码].rollData(realData, index)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]if[代码][代码](++randomData > 9 ){[代码][代码] [代码][代码]if[代码][代码](index === 0) {[代码][代码] [代码][代码]randomData = 1[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]randomData = 0[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]this[代码][代码].rollFunc(randomData, realData,roundData,index)[代码][代码] [代码][代码]},[代码]以上为自定义方法 [代码]this[代码][代码].rollData([1,2,3,4])[代码]我在onload调用方法时,发现小程序并没有动态渲染 想问一下怎么实现这个功能呢 万分感谢(´▽`ʃ♡ƪ)
2018-05-22