78 lines
1.7 KiB
Vue
Raw Normal View History

2024-04-24 17:24:58 +08:00
<template>
<div>
<el-table v-loading="loading" :data="tableData" max-height="500" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<template v-for="item in tableOptions">
<el-table-column
v-if="item.type === 'slot'"
:key="item.prop"
:label="item.label"
:width="item.width"
:fixed="item.fixed"
>"
<template slot-scope="scope">
<slot :name="item.prop" :row="scope.row" />
</template>
</el-table-column>
<el-table-column
v-else
:key="item.prop"
:label="item.label"
:prop="item.prop"
:width="item.width"
:fixed="item.fixed"
/>
</template>
</el-table>
</div>
</template>
<script>
export default {
props: {
loading: {
type: Boolean,
default: false
},
tableOptions: {
type: Array,
default: () => []
},
tableData: {
type: Array,
default: () => []
},
},
data() {
return {
// loading: false,
// tableData: [
// {
// serviceId: 'shgj34',
// serviceName: '服务名称1',
// address: '上海市普陀区金沙江路 1518 弄',
// status: '1',
// version: '1.0.0',
// creator: 'admin',
// createTime: '2024-04-20',
// updateTime: '2024-04-20',
// }
// ],
multipleSelection: [],
}
},
created() {
},
methods: {
handleSelectionChange(val) {
this.multipleSelection = val;
this.$emit('chooseChange', val);
}
}
}
</script>
<style lang="scss" scoped>
</style>