请教大家两个问题:
- 1.最近的一个导出 Excel 需求,找了一些诸如 xlsx 和 xlsx-style 的插件,但是不太适用我的场景,直接将 dom 转为 excel 倒是行得通,但是缺少了表格上的背景色,文字居中,换行的样式,不知道有没有大佬有思路或者能实现的方法。
ps:表格全部是动态数据。
- 2.Element-ui 下递归创建多级表头,如何使用插槽渲染?貌似实现不了? 具体代码如下,想要动态的渲染表格内容,但是自己封装了之后就没法使用官方的插槽了,十分苦恼。
<template>
<el-table-column :prop="'persons_'+cols.remark" :label="cols.title" :width="cols.width?cols.width:150" align="center">
<template v-if="cols.children">
<loop-column v-for="(item, index) in cols.children" :key="index" :cols="item">
</loop-column>
</template>
</el-table-column>
</template>
<script>
export default {
name: "loopColumn",
props: {
cols: {
type: Object,
default: () => {
return {}
}
}
}
}
<script>