【发布时间】:2021-05-31 03:52:12
【问题描述】:
但是,我需要展示
- 电子邮件:电子邮件 muss eine .....
- 电话:电话号码员 ...
如何在 javascript 中做到这一点?实际上我需要在 VueJs 中使用它。
【问题讨论】:
-
到目前为止你尝试过什么?你可以分享一个minimal reproducible example吗?
标签: javascript vue.js
但是,我需要展示
如何在 javascript 中做到这一点?实际上我需要在 VueJs 中使用它。
【问题讨论】:
标签: javascript vue.js
从您从道具收到的屏幕截图中,我们可以在模板中执行此操作:
<template>
<div class="errors">
{{ failureReasons.email ? failureReasons.email[0] }}
</div>
</template>
如果您想将所有错误放入一个数组中(例如['Email mus...', 'Telefon ...']),您可以这样做:
<template>
<ul>
<li v-for="error in Object.keys(failureReasons).map(key => failureReasons[key][0])"> {{ error}} </li>
<ul>
</template>
【讨论】: