解决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>
相关推荐
lyj16899724 分钟前
vue-i18n+vscode+vue 多语言使用
前端·vue.js·vscode
GISer_Jing3 小时前
Monorepo+Pnpm+Turborepo
前端·javascript·ecmascript
天涯学馆3 小时前
前端开发也能用 WebAssembly?这些场景超实用!
前端·javascript·面试
我在北京coding4 小时前
TypeError: Cannot read properties of undefined (reading ‘queryComponents‘)
前端·javascript·vue.js
海天胜景5 小时前
vue3 获取选中的el-table行数据
javascript·vue.js·elementui
翻滚吧键盘5 小时前
vue绑定一个返回对象的计算属性
前端·javascript·vue.js
苦夏木禾5 小时前
js请求避免缓存的三种方式
开发语言·javascript·缓存
超级土豆粉5 小时前
Turndown.js: 优雅地将 HTML 转换为 Markdown
开发语言·javascript·html
乆夨(jiuze)6 小时前
记录H5内嵌到flutter App的一个问题,引发后面使用fastClick,引发后面input输入框单击无效问题。。。
前端·javascript·vue.js