當前位置:成語大全網 - 書法字典 - vue elementui如何動態添加el-form-item項並動態給出驗證提示?

vue elementui如何動態添加el-form-item項並動態給出驗證提示?

```

& ltdiv v-for =“(item,index)intemp . template value“:key =“index“& gt;

?& ltEl-form-item v-if =“0 = = index“:label =“$ t(‘template content value‘)“:prop =“item“:rules =“{ required:true,message: ` $ {item}不能為空`,trigger:‘blur‘}。

& ltEl-input v-model =“temp【item】“:placeholder =“`請輸入${item}內容`“type =“text“style =“width:300 px;顯示:block“/& gt;

?& ltEl-form-item v-else:prop =“item“:rules =“{ required:true,message: ` $ {item}內容不能為空`,trigger:“blur“}“required & gt;

& ltEl-input v-model =“temp【item】“:placeholder =“`請輸入${item}內容`“:rules =“{ required:true,message: ` $ {item}不能為空`,trigger:‘blur‘}“type =“text“style =“。顯示:block“/& gt;

& lt/div & gt;

```