vue.set (target, key, value) this. $ set (won an array of specific data objects, we want to change, re-assignment) Usage

Call the method: Vue.set (target, Key, value) 

target: To change the data source (may be an object or array) 

Key: To change the specific data 

value: the value of re-assign 

specific use
js code:
// set the initial state value and
let j = { id: 0, "progressTime": "", "progressContent": "", "isSet": true, "_temporary": true };
_this.tableInFormData = []
// object is added to the array of 
the this .tableInFormData.push (J);
// item to become true isSet v-if such input box can be used to determine
_this $ SET (_this.tableInFormData [index],. "IsSet", to true )        

Put the following html code:

          <el-table-column label="时间"
                                 width="300"
                                 :show-overflow-tooltip="true">
                    <template slot-scope="scope" >
                         <span v-if="scope.row.isSet">
                             <el-date-picker
                                     v-model="form2.progressTime"
                                     type="datetime"
                                     :picker-options="pickerBeginDateBefore"
                                     format="yyyy-MM-dd HH:mm:ss"
                                     value-format="yyyy-MM-dd HH:mm:ss"
                                     placeholder="选择日期">
                                     <!--:disabled="true">-->
                              </el-date-picker>
                          </span>
                        <span v-else>{{changeTimeToDate(scope.row.ProgressTime) }}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="ProgressContent"
                                 label="处置进展"
                                 :show-overflow-tooltip="true">
                    <template slot-scope="scope">
                         <span v-if="scope.row.isSet">
                             <el-input size="small" v-model="form2.progressContent" placeholder="请输入内容" ></el-input>
                         </span>
                        <span v-else>{{(scope.row.ProgressContent) }}</span>
                    </template>
                </el-table-column>

 

Guess you like

Origin www.cnblogs.com/fallIntoTheStars/p/11983461.html