mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-16 08:38:48 +00:00
90 lines
1.3 KiB
Vue
90 lines
1.3 KiB
Vue
<template>
|
|
<div class="demo-table">
|
|
<cl-table :ref="setRefs('table')" :columns="columns" />
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent, onMounted, ref } from "vue";
|
|
import { TableColumn } from "@cool-vue/crud/types";
|
|
import { useCool } from "/@/cool";
|
|
import Test2 from "./render/test2";
|
|
|
|
export default defineComponent({
|
|
setup() {
|
|
const { refs, setRefs } = useCool();
|
|
|
|
const columns = ref<TableColumn[]>([
|
|
{
|
|
type: "selection",
|
|
width: 60
|
|
},
|
|
{
|
|
label: "姓名",
|
|
prop: "name",
|
|
minWidth: 120,
|
|
component: Test2
|
|
},
|
|
{
|
|
label: "存款",
|
|
prop: "price",
|
|
sortable: true,
|
|
minWidth: 120,
|
|
component: {
|
|
name: "el-progress"
|
|
}
|
|
},
|
|
{
|
|
label: "文件",
|
|
prop: "urls",
|
|
component: {
|
|
name: "cl-link",
|
|
props: {
|
|
size: 50
|
|
}
|
|
}
|
|
},
|
|
{
|
|
label: "状态",
|
|
prop: "status",
|
|
minWidth: 120,
|
|
dict: [
|
|
{
|
|
label: "启用",
|
|
value: 1
|
|
},
|
|
{
|
|
label: "禁用",
|
|
value: 2,
|
|
type: "danger"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: "创建时间",
|
|
prop: "createTime",
|
|
minWidth: 150
|
|
},
|
|
{
|
|
label: "操作",
|
|
type: "op"
|
|
}
|
|
]);
|
|
|
|
onMounted(function () {});
|
|
|
|
return {
|
|
refs,
|
|
setRefs,
|
|
columns
|
|
};
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.demo-table {
|
|
width: 100%;
|
|
}
|
|
</style>
|