鍍金池/ 問(wèn)答/HTML/ vue table下input數(shù)據(jù)綁定的問(wèn)題

vue table下input數(shù)據(jù)綁定的問(wèn)題

<el-table :data="tableData" style="width: 100%;" @selection-change="handleSelectionChange" ref="multipleTable">
             <el-table-column align="center" type="selection" width="55" fixed></el-table-column>
        <el-table-column align="center" prop="name" label="方案名稱" width='120'>
          <!-- <template slot-scope="scope">{{scope.row.beginCardNo}} - {{scope.row.endCardNo}}</template> -->
        </el-table-column>
        <el-table-column align="center" prop ="type" label="兌換類型">
          <!-- <template slot-scope="scope">{{scope.row.cardTypeName}}</template> -->
        </el-table-column>
        <el-table-column align="center" prop ="exchangeNum" label="兌換個(gè)數(shù)" width="160px">
          <template slot-scope="scope">
             <!-- <el-col :span="16"> -->
            <el-input placeholder="請(qǐng)輸入兌換個(gè)數(shù)" v-model="scope.row.exchangeNum"></el-input>
             <!-- </el-col> -->
          </template>
        </el-table-column>
        <!--<el-table-column align="center" prop="" label="未配送數(shù)量"></el-table-column>-->
        <el-table-column align="center" label="消耗積分" prop="costPointsNum">
          <!-- <template slot-scope="scope">{{scope.row.deposit | money}}</template> -->
        </el-table-column>
        <!-- <el-table-column align="center" label="操作" fixed="right">
          <template slot-scope="scope">
            <a class="operation" @click="deleteItem(scope.row)" v-authority="508003">刪除</a>
          </template>
        </el-table-column> -->
      </el-table>

想在

<el-table-column align="center" prop ="exchangeNum" label="兌換個(gè)數(shù)" width="160px">
          <template slot-scope="scope">
             <!-- <el-col :span="16"> -->
            <el-input placeholder="請(qǐng)輸入兌換個(gè)數(shù)" v-model="scope.row.exchangeNum"></el-input>
             <!-- </el-col> -->
          </template>
        </el-table-column>

這個(gè)里面綁定data里面定義好的 exchangeNum 給它一個(gè)默認(rèn)值1 如何綁定
寫成代碼里的是無(wú)效的

回答
編輯回答
孤酒

那你需要處理tableData,遍歷里面每個(gè)exchangeNum都置一個(gè)默認(rèn)值1

2017年11月19日 15:24