Article From:https://segmentfault.com/q/1010000011698346
Question:
<el-dialog title="Select the class "visible.sync=" classForm2 "size=" small ">";< el-table: data= "tableData" class= "tForm">< el-table-column property= "year" label= "enrollment year" width= "180" >< templateSlot-scope= "scope" >< el-select v-model= "tableData.tSchool" placeholder= "please select" >< el-option v-for= "item in teacherTime": key= "item.sTime": label= "item.sTime": value= "item.sTime" >< /el-option>< /el-select>< /teMplate>< /el-table-column>< el-table-column property= "name" label= "class name"Width= "200" >< template slot-scope= "scope" >< el-select v-model= "TaBleData.tClass "placeholder=", please select ">";< el-option v-for= "item in classNam": key= "ite"M.label: "label=" item.label ": value=" item.label ">";< /el-option>&lT; /el-select>< /template>< /el-table-column>< el-table-cOlumn property= "address" label= "teaching subjects" >< template slot-scope= "scope" >< el-select v-model= "tableData.sub" placeholder= "please select" >< el-option v-for= "itemIn sub: "key=" item.sub ": label=" item.sub ": value=" item.sub ">";< /el-option>< /el-select>< /template>< /el-table-column>< el-table-column property= "address" label= "textbook version" >< template slot-scope= "scope" >< el-select v-model= "tableData.book" placeholder= "please select" ><! --< el-Option v-for= "item in teacherTime": key= "item.sTime": label= "item.sTime": value= "item.sTime";T;<! --< /el-option> -->< /el-select>< /templAte>< /el-table-column>< el-table-column property= "address" label= "operation" &gT;< template slot-scope= "scope" >< el-button @click= ">"; add < /el-buTton>< /template>< /el-table-column>< /el-table>< div slot= "footer" class= "dialog-footer" >< el-button @click= "classForm2 = false" >Cancel < /el-button>< el-button type= "primary" @click= "classForm2 = false" > determine < /eL-button>< /div>< /el-dialog>

1,How to use the append method when you click the Add button, or how to insert a row after the form.

Answer 0:

Title, this append is aslotIt is not a method if you want to insert a line directly.tableDataAdding push to one row is good.
Now!
Your form seems to have a problem. Every column should write like this.

    <el-table-column property="address" label="The subjects were ">";< template slot-scope= "scope" >< el-select v-model= "scope.row.sub" plAceholder= "please select" >< el-option v-for= "item in sub": key= "item.sub": label= "item.sub": vAlue= "item.sub" >< /el-option>< /el-select>< /template>< /el-table-column>

Answer 1:

<el-table :data="tableData">
Just put the data you want to add directly into push tableData.

Leave a Reply

Your email address will not be published. Required fields are marked *