element-ui表格里面添加表單,并且進(jìn)行表單驗(yàn)證

小魚(yú)兒心語(yǔ):噴泉之所以漂亮是因?yàn)樗辛藟毫?;瀑布之所以壯觀是因?yàn)樗鼪](méi)有了退路;水之所以能穿石是因?yàn)橛肋h(yuǎn)在堅(jiān)持。人生亦是如此。加油!

通過(guò)el-form和el-table的組合使用,在表格里面添加表單 并且進(jìn)行驗(yàn)證 表單中v-model綁定scope.row中表格的數(shù)據(jù).

<el-form :model="weightcontent" ref="queryRefqz" :inline="true" v-show="showSearch" label-width="68px" style="margin-left: 20px;height: 100%;" @submit.native.prevent>
    <el-table v-loading="loading" :data="weightcontent.bznrList" @selection-change="handleSelectionChange" class="tables">
      <el-table-column type="selection" width="55" align="center" />
              <el-table-column label="編號(hào)" align="center" prop="number" width="50"/>
              <el-table-column label="標(biāo)準(zhǔn)" align="center" prop="content" width="250">
                <template #default="scope">
                      <span v-html="scope.row.content"></span>
                </template>
              </el-table-column>
              <el-table-column label="標(biāo)準(zhǔn)分值" align="center" prop="total" />
              <el-table-column label="權(quán)重" align="center" prop="weight" >
                <template #default="scope">
                    <el-form-item :prop="`bznrList.${scope.$index}.weight`" :rules="{
                    required: true,
                    message: '請(qǐng)輸入權(quán)重',
                    trigger: 'blur',
                    }">
                      <el-input
                            v-model="scope.row.weight"
                            placeholder="請(qǐng)輸入權(quán)重"
                            clearable
                            @blur.stop="$event => editSave(scope.row)"
                      >
                      </el-input>
                    </el-form-item>
                </template>
              </el-table-column>
    </el-table>
  </el-form>
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容