</view>
<button type="primary" @click="test"></button>
<script>
data(){
return{
chart1: [ ],
chartData1:{
categories: Array(1000).fill("0"),
series: [
{
data: [ ]
}
]
},
}
},
methods:{
test() {
uni.request({
url: 'http://xxxx',
success: (res1) => {
const newData = res1.data.data[0]
this.chart1 = [...this.chart1, ...newData];
if (this.chart1.length >= this.dataNum) {
this.chart1 = this.chart1.slice(this.chart1.length - this.dataNum);
}
this.chartData1.series[0].data = this.chart1;
}
});
}
</script>
0 个回复