1.首先把模拟的数据以json的格式存放在public–data的文件夹下
格式如下
{
"data": {
"text": "个人数据",
"conditions": [
{
"label": "姓名",
"name": "name",
"text": "张三"
},
{
"label": "年龄",
"name": "age",
"code": 18
}
]
},
"code": "200",
"msg": "成功"
}
2.直接axios调用(没有封装)
// 获取本地JSON
getJson() {
this.$axios.get('data/analysis-report/custom-during-analysis.json').then(res => {
// 获得数据
console.log(res)
})
},