发布时间:2021-02-07 09:53:24编辑:admin阅读(4461)
现有一个基于element-ui开发的后台页面,效果如下:

需要将公司名进行切割,每一行,显示一个公司。
test.vue
<template>
<el-table
:data="tableData"
border
style="width: 362px">
<el-table-column
prop="id"
label="id"
width="180">
</el-table-column>
<el-table-column
prop="name"
label="公司名"
width="180">
<template slot-scope="scope">
<div v-for="item in companyCut(scope.row.name)">
{{item}}<br>
</div>
</template>
</el-table-column>
</el-table>
</template>
<script>
export default {
name: "test",
data() {
return {
tableData: [{
id: '2016-05-02',
name: '阿里云',
}, {
id: '2016-05-04',
name: '腾讯控股、字节跳动',
}, {
id: '2016-05-01',
name: '美团、金蝶国际、台积电',
}]
}
},
methods: {
// 切割公司列表
companyCut(name){
let company=name.split("、")
return company
},
}
}
</script>
<style scoped>
</style>效果如下:

上一篇: ElementUI 分页
下一篇: vue 验证码
51671
51312
41761
38540
33014
30030
28705
23688
23605
21966
2153°
2860°
2379°
2322°
2861°
2333°
3122°
5111°
4951°
3540°