【发布时间】:2020-03-04 13:25:16
【问题描述】:
我正在尝试使用 <el-tag> 显示食谱的类别,但是它们都显示为一个在另一个之下:
我希望他们更像这样
这些标签位于具有这种结构的<el-table> 中
<el-table>
<el-table-column
prop="name"
label="Name">
</el-table-column>
<el-table-column
label="Category">
<template slot-scope="scope">
<div class="tag-container" v-for="cat in scope.row.categories">
<el-tag type="success">{{cat.name}}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column
align="right">
<template slot="header" slot-scope="scope">
<el-input
v-model="search"
size="medium"
placeholder="Search"/>
</template>
<template slot-scope="scope">
<div class="btn-link-edit action-button" @click="edit(scope.row)">
<i class="fas fa-pencil-alt"></i>
</div>
<div class="btn-link-delete action-button" @click="remove(scope.row)">
<i class="fas fa-trash"></i>
</div>
</template>
</el-table-column>
</el-table>
我也创建了类
.tag-container {
display: flex;
flex-direction: row;
}
有没有办法让它们看起来像我展示的示例?
【问题讨论】:
-
使用flex box
-
@MikeRoss 这些在表格行中,还可以在那里使用吗?
-
添加更多代码或小提琴,以便我们提供更多帮助。
-
@MikeRoss 我已经添加了表结构
-
我用的是Element-ui表格组件element.eleme.io/#/en-US/component/table
标签: laravel vue.js element-ui