在使用elment的table时,有一个默认行高,多次试验后发现只有这句代码的确管用
下图是例子,为el-tanble中添加属性
:row-style="{height:'50px'}" // 行样式,注意书写格式!!!
<el-table
:data="tableData"
:row-style="{height:'50px'}">
<el-table-column label="序号" align="center">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.id }}</span>
</template>
</el-table-column>
<el-table-column label="姓名" align="center">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="电话" align="center">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.tel }}</span>
</template>
</el-table-column>
</el-table>
<script>
export default {
data() {
return {
tableData: [{
id: '001',
name: '钱钱',
tel: '454545645'
}, {
id: '002',
name: '问问',
tel: '456456456'
}, {
id: '003',
name: '恩恩',
tel: '787879542'
}]
}
}
}
</script>
只是简单的理解,若有错误还望谅解指正!