Skip to content

Commit

Permalink
perf: 优化free模式,支持默认不激活
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Dec 19, 2023
1 parent b600985 commit 8b9722b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/views/crud/editable/free/crud.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
},
table: {
editable: {
mode: "free"
mode: "free",
activeDefault: true,
showAction: false
}
},
pagination: {
Expand Down
18 changes: 11 additions & 7 deletions src/views/crud/editable/free/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
<a-radio-button :value="true">启用编辑</a-radio-button>
<a-radio-button :value="false">退出编辑</a-radio-button>
</a-radio-group>
<!-- <a-radio-group class="ml-1" v-model="crudBinding.table.editable.mode">-->
<!-- <a-radio-button label="free">自由模式</a-radio-button>-->
<!-- <a-radio-button label="row">行编辑模式</a-radio-button>-->
<!-- </a-radio-group>-->
<a-radio-group v-model:value="crudBinding.table.editable.showAction" class="ml-1">
<a-radio-button :value="true">显示操作按钮</a-radio-button>
<a-radio-button :value="false">不显示</a-radio-button>
</a-radio-group>
<a-radio-group v-model:value="crudBinding.table.editable.activeDefault" class="ml-1">
<a-radio-button :value="true">默认激活</a-radio-button>
<a-radio-button :value="false">默认不激活</a-radio-button>
</a-radio-group>
<template v-if="crudBinding.table.editable.enabled">
<fs-button class="ml-5" @click="save">保存</fs-button>
<fs-button class="ml-5" @click="log">log</fs-button>
Expand All @@ -25,9 +29,9 @@
</template>

<script lang="ts">
import { defineComponent, onMounted } from "vue";
import { defineComponent, onMounted, ref } from "vue";
import createCrudOptions from "./crud";
import {useFs, utils} from "@fast-crud/fast-crud";
import { useFs, utils } from "@fast-crud/fast-crud";
import { message } from "ant-design-vue";
export default defineComponent({
Expand All @@ -38,7 +42,7 @@ export default defineComponent({
// 页面打开后获取列表数据
onMounted(() => {
crudExpose.doRefresh();
crudExpose.editable.enable({ mode: "free", activeDefault: true });
crudExpose.editable.enable({ mode: "free" });
});
return {
Expand Down

0 comments on commit 8b9722b

Please sign in to comment.