遇到鬼了,关于number转string问题?
this.setData({
text1: ‘\n cpu得分:’ + int1 + ‘排名’ + cputotal
cputotal是number类型,log时候能调试出来,放在这里就读不出来了额 其实是下面问题:数据库回调函数如何访问全局变量?
db.collection(“shouji”).where({
cpu: _.gte(int1)
}).count({
success: function (res) {
console.log(“cpu测试排行开始11”)
console.log(“cpu测试排行开始11q”)
cputotal = res.total
s1 = cputotal
console.log( s1)
// console.log(res.countResult.total)
cpuint = cputotal
console.log(“cpu测试排行结束”)
}
})
只要代码一出去,s1就没了,在函数内正常