瀏覽代碼

添加自动列宽

xiaohaizhao 10 月之前
父節點
當前提交
4e053f1e79
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/template/tableDetailLayout/index.vue

+ 2 - 2
src/template/tableDetailLayout/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="bs-table" >
-    <el-table border stripe ref="tables" :row-class-name="tableClassName" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}" :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}"  highlight-current-row :data="data" size="mini" @row-click="rowClick" :height="height" @selection-change="handleSelectionChange" >
+    <el-table border stripe ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)" :row-class-name="tableClassName" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}" :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}"  highlight-current-row :data="data" size="mini" @row-click="rowClick" :height="height" @selection-change="handleSelectionChange" >
       <el-table-column
           type="selection"
           v-if="isCheck === true"
@@ -8,7 +8,7 @@
           align="center"
           @handleSelectionChange="handleSelectionChange">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :min-width="col.width === 0 ? 150 : col.width" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
+      <el-table-column show-overflow-tooltip v-for="(col) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
         <template slot-scope="scope">
 
           <slot v-if="col.columnname !== 'operation'" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>