当副标题值为0时,这个时候上诉代码就会导致副标题不显示。原因是因为echarts在渲染的时候,会进行一波if判断。恰好0代表false,这样会导致副标题不渲染。
title: {
text: this.titleType,
subtext: this.totalNum, //副标题文本
left: "center",
top: "35%",
},
改动后:
title: {
text: this.titleType,
subtext: this.totalNum + "", //副标题文本 (这里改动)
left: "center",
top: "35%",
},