1.hml

2.css

3.js
export default {
? ? data: {
? ? ? ? title: 'World',
//? ? ? ? 圓形選擇器
? ? options:{
? ? ? ? xAxis:{},
? ? ? ? yAxis:{min:0,max:230}
? ? },
//? ? ? ? 數(shù)據(jù)集
? ? ? ? datasets : [{
? ? ? ? gradient:true,? //設(shè)置是否顯示為漸變的顏色
? ? ? ? data:[50,90,120,115,99,120,126,116,105,104,122,109,111]
? ? }]
? ? },
? ? onInit(){
//? ? ? ? 循環(huán)100次 將隨機(jī)數(shù)放到數(shù)組內(nèi)
? ? ? ? for (var i = 0; i < 100; i++) {
//? ? ? ? ? ? ? ? 把數(shù)組的內(nèi)容填滿
? ? ? ? ? ? this.datasets[0].data.push(this.getRandInter(80,200));
? ? ? ? }
? ? },
//js中隨機(jī)生成的函數(shù)? min? max(都包括 )的一個隨機(jī)數(shù)
? ? ? ? getRandInter(min ,max){
? ? ? ? ? ? return Math.floor(Math.random()*(max-min+1))+min;
? ? ? ? }
}
