gpt4 book ai didi

vue.js - 从 Array JS vue 中获取值

转载 作者:行者123 更新时间:2023-12-04 13:29:27 24 4
gpt4 key购买 nike

谁能指出我正确的方向,让我可以阅读有关解决方案的信息。它在控制台中运行良好,此时失去了想法。

Promise.all([
DishSource.getDishDetails(523145),
DishSource.getDishDetails(787321),
DishSource.getDishDetails(452179),
]).then((values) =>
Vue.render(
<SidebarView guests={5} dishes={values} />,
document.getElementById("app")
)
);
侧边栏 View :
<table>
{props.dishes.values.map((e) => (
<tr>
<td>
<button> x </button>
</td>
<td>{e.title}</td>
<td>{e.dishType}</td>
<td>{e.dishPrice}</td>
</tr>
))}
</table>
Error msg + console logs

最佳答案

第一次渲染 dishes属性不可用,因此您应该添加一些条件渲染:

{props.dishes && props.dishes.values.map(e => ...

关于vue.js - 从 Array JS vue 中获取值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65968042/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com