如图想在页面加载的时候从数据库获取一些信息加载到页面上。但是回调函数中的ret获取到的是请求的一些信息
想要获取到后端传回来的数据应该怎么解决,求解答。
如图想在页面加载的时候从数据库获取一些信息加载到页面上。但是回调函数中的ret获取到的是请求的一些信息
想要获取到后端传回来的数据应该怎么解决,求解答。
看文档 https://github.com/pagekit/vu...
A request resolves to a response object with the following properties and methods:
Property | Type | Description |
---|---|---|
url | string |
Response URL origin |
body |
Object , Blob , string
|
Response body data |
headers | Header |
Response Headers object |
ok | boolean |
HTTP status code between 200 and 299 |
status | number |
HTTP status code of the response |
statusText | string |
HTTP status text of the response |
Method | Type | Description |
text() | Promise |
Resolves the body as string |
json() | Promise |
Resolves the body as parsed JSON object |
blob() | Promise |
Resolves the body as Blob object |
这个回调函数不止只有一个参数的,你可以把参数都打出来看看
console.log(arguments)
我不是这种方式拿的,不是很清楚,应该有3个参数,第二个应该是你要的
或者是data里?
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答4.7k 阅读✓ 已解决
4 回答4.3k 阅读✓ 已解决
4 回答1.8k 阅读✓ 已解决
2 回答2.6k 阅读✓ 已解决
2 回答2.5k 阅读✓ 已解决
一般是看 ret.data