我在網上看到的解決方案很少,但它并沒有解決我的問題。我在回應中得到 JSON 物件。
<!-- Show Negativita Check Azienda -->
<table class="divide-y divide-gray-200 table-fixed w-full mt-4" v-if="showTableAzienda" v-for="item in impreses">
<thead class="bg-gray-900">
<tr>
<th>Codice Fiscale</th>
<th>Flag Domande</th>
<th>Flag Pregiudizievoli</th>
<th>Flag Procedure</th>
<th>Flag Protesti</th>
<th>Data Evasione</th>
</tr>
</thead>
<tbody class="text-center py-6" >
<tr>
<td>{{item.codice_fiscale}}</td>
<td>{{item.flagDomande}}</td>
<td>{{item.flagPregiudizievoli}}</td>
<td>{{item.flagProcedure}}</td>
<td>{{item.flagProtesti}}</td>
<td>{{item.dataEvasione}}</td>
</tr>
</tbody>
</table>
這是 JSON 回應
{
"codice_fiscale":"CLLLCA82R69D960T",
"flagDomande":"N",
"flagPregiudizievoli":"N",
"flagProcedure":"N",
"flagProtesti":"N",
"dataEvasione":"2021-11-04"
}
因為物件中的元素是六個。它th在沒有輸出的情況下生成了六次。如果我列印,{{impreses.codice_fiscale}}那么它會顯示輸出。我無法理解行為。
編輯 第二個問題
{"EventiNegativiPersona":
{"InfoPersona":
{"Nominativo":
{"@attributes":{"cognome":"","nome":""}},
"CodiceFiscale":"CLLLCA82R69D960T"},
"ElencoProtesti":{"@attributes":
{"flagPresenza":"N"}},"ElencoPregiudizievoli":
{"@attributes":{"flagPresenza":"N"}}}}
我想展示這些,但{{[email protected]}}由于@parameters. 我怎樣才能顯示這個?
uj5u.com熱心網友回復:
根據您的問題中顯示的回應物件,您可以將 移動v-for到td標簽:
<table class="..." v-if="showTableAzienda" >
<thead class="bg-gray-900">
<tr>
<th>Codice Fiscale</th>
<th>Flag Domande</th>
<th>Flag Pregiudizievoli</th>
<th>Flag Procedure</th>
<th>Flag Protesti</th>
<th>Data Evasione</th>
</tr>
</thead>
<tbody class="text-center py-6" >
<tr>
<td v-for="item in impreses">{{item}}</td>
</tr>
</tbody>
</table>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/348560.html
上一篇:沒有文字的下拉選單
