mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-15 14:03:36 +08:00
feat: add ample demos to @pureadmin/table (#379)
* feat: add ample demos to @pureadmin/table
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { ref } from "vue";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export function useColumns() {
|
||||
const columns = ref([
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
type: "selection",
|
||||
width: 55,
|
||||
@@ -13,7 +12,6 @@ export function useColumns() {
|
||||
label: "序号",
|
||||
type: "index",
|
||||
width: 60,
|
||||
align: "left",
|
||||
hide: ({ checkList }) => !checkList.includes("序号列")
|
||||
},
|
||||
{
|
||||
@@ -58,7 +56,7 @@ export function useColumns() {
|
||||
width: 140,
|
||||
slot: "operation"
|
||||
}
|
||||
]);
|
||||
];
|
||||
|
||||
return {
|
||||
columns
|
||||
|
||||
@@ -99,11 +99,12 @@ onMounted(() => {
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-slot="{ size, checkList }">
|
||||
<PureTable
|
||||
<pure-table
|
||||
ref="tableRef"
|
||||
border
|
||||
align="center"
|
||||
align-whole="center"
|
||||
row-key="id"
|
||||
showOverflowTooltip
|
||||
table-layout="auto"
|
||||
default-expand-all
|
||||
:size="size"
|
||||
@@ -142,7 +143,7 @@ onMounted(() => {
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</PureTable>
|
||||
</pure-table>
|
||||
</template>
|
||||
</TableProBar>
|
||||
</div>
|
||||
|
||||
@@ -6,10 +6,11 @@ import { Switch, message } from "@pureadmin/components";
|
||||
export function useColumns() {
|
||||
const switchLoadMap = ref({});
|
||||
|
||||
const columns = ref([
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
type: "selection",
|
||||
width: 55,
|
||||
align: "left",
|
||||
hide: ({ checkList }) => !checkList.includes("勾选列")
|
||||
},
|
||||
{
|
||||
@@ -60,7 +61,7 @@ export function useColumns() {
|
||||
unCheckedValue={0}
|
||||
checked-children="已开启"
|
||||
un-checked-children="已关闭"
|
||||
onChange={() => onChange(scope)}
|
||||
onChange={() => onChange(scope as any)}
|
||||
/>
|
||||
)
|
||||
},
|
||||
@@ -77,7 +78,7 @@ export function useColumns() {
|
||||
width: 180,
|
||||
slot: "operation"
|
||||
}
|
||||
]);
|
||||
];
|
||||
|
||||
function onChange({ row, index }) {
|
||||
ElMessageBox.confirm(
|
||||
|
||||
@@ -118,9 +118,9 @@ onMounted(() => {
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-slot="{ size, checkList }">
|
||||
<PureTable
|
||||
<pure-table
|
||||
border
|
||||
align="center"
|
||||
align-whole="center"
|
||||
showOverflowTooltip
|
||||
table-layout="auto"
|
||||
:size="size"
|
||||
@@ -199,7 +199,7 @@ onMounted(() => {
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</PureTable>
|
||||
</pure-table>
|
||||
</template>
|
||||
</TableProBar>
|
||||
</div>
|
||||
|
||||
@@ -6,10 +6,11 @@ import { Switch, message } from "@pureadmin/components";
|
||||
export function useColumns() {
|
||||
const switchLoadMap = ref({});
|
||||
|
||||
const columns = ref([
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
type: "selection",
|
||||
width: 55,
|
||||
align: "left",
|
||||
hide: ({ checkList }) => !checkList.includes("勾选列")
|
||||
},
|
||||
{
|
||||
@@ -65,7 +66,7 @@ export function useColumns() {
|
||||
unCheckedValue={0}
|
||||
checked-children="已开启"
|
||||
un-checked-children="已关闭"
|
||||
onChange={() => onChange(scope)}
|
||||
onChange={() => onChange(scope as any)}
|
||||
/>
|
||||
)
|
||||
},
|
||||
@@ -82,7 +83,7 @@ export function useColumns() {
|
||||
width: 180,
|
||||
slot: "operation"
|
||||
}
|
||||
]);
|
||||
];
|
||||
|
||||
function onChange({ row, index }) {
|
||||
ElMessageBox.confirm(
|
||||
|
||||
@@ -131,9 +131,9 @@ onMounted(() => {
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-slot="{ size, checkList }">
|
||||
<PureTable
|
||||
<pure-table
|
||||
border
|
||||
align="center"
|
||||
align-whole="center"
|
||||
table-layout="auto"
|
||||
:size="size"
|
||||
:data="dataList"
|
||||
@@ -211,7 +211,7 @@ onMounted(() => {
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</PureTable>
|
||||
</pure-table>
|
||||
</template>
|
||||
</TableProBar>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user