zoukankan      html  css  js  c++  java
  • xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

    vue & template & v-else & v-for bug

    nested table bug

    https://codepen.io/xgqfrms/pen/wvaGmGE

    bug

          <el-table-column
            v-for="({
              prop,
              label,
              align,
              width,
              slot,
            }, i) in selectManageClomuns"
            :key="prop + i"
            :prop="prop"
            :width="width"
            :align="align"
            :label="label">
            <!-- rowSpan ??? -->
            <template
              v-if="tableData[scope.$index].render"
              slot-scope="scope">
              <span>
                {{tableData[scope.$index][prop]}}
              </span>
              <div v-if="prop === 'showName'">
                <el-button
                  type="primary"
                  size="small"
                  @click="editHandler(scope.$index, scope.row)">
                  关闭选排
                </el-button>
                <el-button
                  type="primary"
                  size="small"
                  @click="editHandler(scope.$index, scope.row)">
                  创建新模版
                </el-button>
              </div>
              <div v-else></div>
            </template>
            <template
              v-else
              slot-scope="scope">
              <span>
                {{tableData[scope.$index][prop]}}
              </span>
            </template>
          </el-table-column>
    
    

    solution

    not using v-else template in v-for, instead of using div as box

    
          <el-table-column
            v-for="({
              prop,
              label,
              align,
              width,
              slot,
            }, i) in selectManageClomuns"
            :key="prop + i"
            :prop="prop"
            :width="width"
            :align="align"
            :label="label">
            <!-- rowSpan ??? -->
            <template
              slot-scope="scope">
              <div v-if="tableData[scope.$index].render">
                <span>
                  {{tableData[scope.$index][prop]}}
                </span>
                <div v-if="prop === 'showName'">
                  <el-button
                    type="primary"
                    size="small"
                    @click="editHandler(scope.$index, scope.row)">
                    关闭选排
                  </el-button>
                  <el-button
                    type="primary"
                    size="small"
                    @click="editHandler(scope.$index, scope.row)">
                    创建新模版
                  </el-button>
                </div>
              </div>
              <div v-else>
                <span v-if="prop !== 'showName'">
                  {{tableData[scope.$index][prop]}}
                </span>
              </div>
            </template>
          </el-table-column>
    
    


  • 相关阅读:
    Angular 路由的参数传递
    Angular 指令的属性和事件绑定
    Angular 组件的双向绑定
    Angular 组件视图封装模式
    Angular 组件生命周期的顺序
    简谈 Angular 动态绑定样式的几种方法
    Angular 表单快速入门
    如何在 Angular CLI 创建的项目中自定义 webpack 配置
    bootstrap图标菜单按钮组件
    vue指令
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/12323276.html
Copyright © 2011-2022 走看看