最后
由于篇幅限制,pdf文档的详解资料太全面,细节内容实在太多啦,所以只把部分知识点截图出来粗略的介绍,每个小节点里面都有更细化的内容!
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
export default {
data() {
return {
// 定义图表,各种参数
msg: “柱状图”,
datay: [5, 10, 43, 54, 34, 32],
};
},
mounted: function () {
this.drawLine(); //按照默认值绘制图表
},
created() {
this.$axios.get(“findPatientAge”).then((response) => {
console.log(response);
if (response.data.statusCode == 200) {
this.datay.length = 0; //清空数组
for (let i = 0; i < response.data.data.length; i++) {
this.datay.push(response.data.data[i]);
}
console.log(this.datay);
}
});
},
watch: {
datay: {
//对于深层对象的属性,watch不可达,因此对数组监控需要将数组先清空,再添加数据
handler: function () {
this.drawLine();
},
deep: true,