解决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>
相关推荐
百思可瑞教育3 小时前
uni-app 根据用户不同身份显示不同的tabBar
vue.js·uni-app·北京百思可瑞教育·北京百思教育
雾恋7 小时前
最近一年的感悟
前端·javascript·程序员
华仔啊7 小时前
Vue3 的 ref 和 reactive 到底用哪个?90% 的开发者都选错了
javascript·vue.js
A黄俊辉A7 小时前
axios+ts封装
开发语言·前端·javascript
小李小李不讲道理8 小时前
「Ant Design 组件库探索」四:Input组件
前端·javascript·react.js
郑板桥308 小时前
tua-body-scroll-lock踩坑记录
前端·javascript
IT古董9 小时前
Vue + Vite + Element UI 实现动态主题切换:基于 :root + SCSS 变量的最佳实践
vue.js·ui·scss
解道Jdon9 小时前
SpringBoot4与Spring7发布:云原生深度进化
javascript·reactjs
gnip10 小时前
pnpm 的 monorepo架构多包管理
前端·javascript
zolty10 小时前
基于hiprint的票据定位打印系统开发实践
javascript