我正在try 获取总结果长度,但我的模板中什么也得不到 这是我的 playbook
data() {
return {
searchResults: [],
totalResults: [],
}}
const response = await axios.post(
"http://localhost:5000/api/search",
searchData
);
this.searchResults = response.data.Response.Results; // Set the search results in the component's data // Retrieve the traceId from the response
const nestedResults = response.data.Response.Results;
const totalResults = nestedResults[0].length;
console.log("Total Results:", totalResults);
这是我的控制台,我正在获取总结果
Total Results: 12
这是我的模板
<p>Total Results: {{ totalResults }}</p>
模板返回此消息
Total Results: []
我的模板中没有任何内容,请告诉我该怎么做