vue & template & v-else & v-for bug
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 inv-for
, instead of usingdiv
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>
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/12323276.html
未经授权禁止转载,违者必究!