vue发送axios请求服务器返回值拿不到data值
vue发送axios请求服务器返回值时直接输出Response.data是正确的值,
script>
import pubsub from 'pubsub-js'
import axios from "axios"
export default {
name:"serch",
data(){
return {
serchname:"",
serchtype:"",
li:[]
}
},
methods:{
gget(){
axios.get('http://localhost:8081/selectall/',{params:{name:this.serchname,type:this.serchtype}}
).
then(Response =>{
console.log(Response.data)
},
error =>{
console.log(error)
}
输出的值就是正确的json数组

但是当将Response.data放入vue里就不行,就拿不到data,
```html
<script>
import pubsub from 'pubsub-js'
import axios from "axios"
export default {
name:"serch",
data(){
return {
serchname:"",
serchtype:"",
li:[]
}
},
methods:{
gget(){
axios.get('http://localhost:8081/selectall/',{params:{name:this.serchname,type:this.serchtype}}
).
then(Response =>{
this.li=Response.data
console.log(this.li)
},
error =>{
console.log(error)
}
结果是这样
