el-table多个表格切换显示时表格渲染错乱

el-table多个表格切换显示时表格渲染错乱


el-table多个表格切换显示时表格渲染错乱

el-table多个表格切换显示时表格渲染错乱
如上图所示,通过下拉切换显示不同的表格,点击编辑显示多选框,当编辑完之后,表格显示错乱,解决方式代码如下:

 <tempalte    v-if="selectTypeValue === '1'">
                      <el-table
                        :data="gdphistoryData"
                        style="width: 100%"
                        @selection-change="handleSelectionChange1"
                        class="load_table_list"
                        :key="Math.random()"
                      >
                        <el-table-column
                          fixed
                          type="selection"
                          width="55"
                          v-if="clearTable1 && selectTypeValue === '1'"
                        >
                        </el-table-column>
                        <el-table-column
                          fixed
                          prop="year"
                          label="年份"
                          width="100">
                        </el-table-column>
                        <el-table-column
                          prop="gdp"
                          label="GDP(亿元)"
                          min-width="180">
                          <template slot-scope="scope">
                            <el-input-number v-model="scope.row.gdp" v-if="edit1" :controls="false" > </el-input-number>
                            <span v-else>{{scope.row.gdp}}</span>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="first"
                          label="第一产业(亿元)"
                          min-width="180">
                          <template slot-scope="scope">
                            <el-input-number v-model="scope.row.first" v-if="edit1" :controls="false" > </el-input-number>
                            <span v-else>{{scope.row.first}}</span>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="second"
                          label="第二产业(亿元)"
                          min-width="180">
                          <template slot-scope="scope">
                            <el-input-number v-model="scope.row.second" v-if="edit1" :controls="false" > </el-input-number>
                            <span v-else>{{scope.row.second}}</span>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="three"
                          label="第三产业(亿元)"
                          min-width="180">
                          <template slot-scope="scope">
                            <el-input-number v-model="scope.row.three" v-if="edit1" :controls="false" > </el-input-number>
                            <span v-else>{{scope.row.three}}</span>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="total"
                          label="总人口(万人)"
                          min-width="180">
                          <template slot-scope="scope">
                            <el-input-number v-model="scope.row.total" v-if="edit1" :controls="false" > </el-input-number>
                            <span v-else>{{scope.row.total}}</span>
                          </template>
                        </el-table-column>
                      </el-table>
                    </tempalte>

el-table 包裹在template中,通过template控制表格的显示与隐藏

el-table 添加key属性

上一篇:JBOSS EAP实战(2)-集群、NGINX集成、队列与安全


下一篇:【OCP最新题库解析(052)--题51】 You want to use the ALTER SYSTEM statement