parent
c6aefe600d
commit
35e2cbb7ff
@ -0,0 +1,12 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"name": "手机",
|
||||
"price": 1000
|
||||
},
|
||||
{
|
||||
"name": "电脑",
|
||||
"price": 5000
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import axios from "axios"
|
||||
import request from "../utils/request.js"
|
||||
|
||||
export default {
|
||||
name: "Axios",
|
||||
data() {
|
||||
return {data: []}
|
||||
},
|
||||
mounted() {
|
||||
request.get("/data/data1.json").then(res => {
|
||||
this.data = res.data
|
||||
console.log(res)
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
}).finally(() => {
|
||||
console.log("结束")
|
||||
})
|
||||
|
||||
// fetch("/data/data.json").then(res => {
|
||||
// console.log(res)
|
||||
// })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
Reference in new issue