解决el-table表格没有横向滚动条

表头数据过多,需要添加横向滚动条

解决方法:每个column 中添加min-width属性

html 复制代码
                <!-- 表单表格 -->
                <el-table
                    :data="H5Store.H5list"
                    @selection-change="selectTbhandle"
                    style="width: 100%"
                >
                    <el-table-column type="selection" min-width="60"> </el-table-column>

                    <el-table-column label="模板名称" min-width="180">
                        <template #default="{ row }">
                            <div class="flex">
                                <img
                                    style="width: 100px; height: 60px"
                                    :src="row.templateCover"
                                    alt=""
                                />
                                <p style="font-size: 12px; margin-left: 5px">{{ row.name }}</p>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column prop="templateType" label="模板类型" min-width="100">
                    </el-table-column>
                    <el-table-column prop="industryTypeList" label="适用行业分类" min-width="150">
                    </el-table-column>
                    <el-table-column prop="applicableHolidays" label="适用节日" min-width="120">
                    </el-table-column>
                    <el-table-column prop="applicablePurposeList" label="行业用途" min-width="120">
                    </el-table-column>
                    <el-table-column prop="isShelves" label="是否上架" min-width="100">
                        <template #default="{ row }">
                            <span>{{ row.isShelves ? '已上架' : '已下架' }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="createdTime" label="创建时间" min-width="150">
                    </el-table-column>
                    <el-table-column label="操作" min-width="200">
                        <template #default="{ row }">
                            <div class="flex justify-start">
                                <el-button type="link" @click="Edit(row.id)" size="small"
                                    >编辑</el-button
                                >
                                <el-button
                                    v-if="!row.isShelves"
                                    @click="upisShelves(row)"
                                    type="link"
                                    size="small"
                                    >上架</el-button
                                >
                                <el-button
                                    v-else
                                    @click="downisShelves(row)"
                                    type="link"
                                    size="small"
                                    >下架</el-button
                                >
                                <el-button @click="Del(row.id)" type="link" size="small"
                                    >删除</el-button
                                >
                            </div>
                        </template>
                    </el-table-column>
                </el-table>
相关推荐
萌萌哒草头将军1 小时前
10个 ES2025 新特性速览!🚀🚀🚀
前端·javascript·vue.js
gnip2 小时前
http缓存
前端·javascript
JohnYan3 小时前
工作笔记 - 微信消息发送和处理
javascript·后端·微信
陈陈爱java3 小时前
Spring八股文
开发语言·javascript·数据库
@大迁世界4 小时前
用 popover=“hint“ 打造友好的 HTML 提示:一招让界面更“懂人”
开发语言·前端·javascript·css·html
烛阴4 小时前
【TS 设计模式完全指南】用工厂方法模式打造你的“对象生产线”
javascript·设计模式·typescript
定栓4 小时前
Typescript入门-类型断言讲解
前端·javascript·typescript
xiaominlaopodaren4 小时前
“UI里就可以请求数据库”,让你陌生的 React 特性
前端·javascript·react.js
薛定谔的算法4 小时前
JavaScript数组操作完全指南:从基础到高级
前端·javascript·算法
用户22152044278004 小时前
Promise实例方法和async、await语法糖
前端·javascript