Files
Situation-Awareness-Platfor…/src/components/AIRepair/Table.vue

43 lines
997 B
Vue
Raw Normal View History

2025-03-14 20:03:14 +08:00
<template>
<d-table :data="dataSource" @sort-change="handleSortChange" :header-bg="true">
2025-03-25 09:15:17 +08:00
<d-column v-for="(column, index) in props.tableConfig" :field="column.field" :header="column.header"></d-column>
2025-03-14 20:03:14 +08:00
</d-table>
</template>
<script>
import { defineComponent, ref, onMounted } from 'vue';
export default defineComponent({
props: {
tableConfig: {
type: Array,
2025-03-25 09:15:17 +08:00
default: () => []
2025-03-14 20:03:14 +08:00
},
dataSource: {
type: Array,
2025-03-25 09:15:17 +08:00
default: () => []
}
2025-03-14 20:03:14 +08:00
},
setup(props) {
onMounted(() => {
console.log('props', props);
});
const handleSortChange = ({ field, direction }) => {
console.log('field', field);
console.log('direction', direction);
};
const sortDateMethod = (a, b) => {
return a.date > b.date;
};
const sortNameMethod = (a, b) => {
return a.lastName > b.lastName;
};
return { props, handleSortChange, sortDateMethod, sortNameMethod };
2025-03-25 09:15:17 +08:00
}
2025-03-14 20:03:14 +08:00
});
</script>
2025-03-25 09:15:17 +08:00
<style scoped lang="scss"></style>