data中定义数据
colorArr:[ " red ", " black " , " yellow ", " green "]
methods或其他需要的地方使用
this.colorArr[Math.floor(Math.random()*this.colorArr.length) ]
// 随机从1到10中取一个整数
console.log(parseInt(Math.random()*10))
data中定义数据
colorArr:[ " red ", " black " , " yellow ", " green "]
methods或其他需要的地方使用
this.colorArr[Math.floor(Math.random()*this.colorArr.length) ]
// 随机从1到10中取一个整数
console.log(parseInt(Math.random()*10))