pull/87/head
xingyu4j 2025-04-26 14:38:07 +08:00
commit 4d1bff9d4a
7 changed files with 49 additions and 15 deletions

View File

@ -114,8 +114,6 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
```ts
const dashboardMenus = [
{
// 这里固定写死 BasicLayout不可更改
component: 'BasicLayout',
meta: {
order: -1,
title: 'page.dashboard.title',
@ -144,6 +142,16 @@ const dashboardMenus = [
},
],
},
{
name: 'Test',
path: '/test',
component: '/test/index',
meta: {
title: 'page.test',
// 部分特殊页面如果不需要基础布局页面顶部和侧边栏可将noBasicLayout设置为true
noBasicLayout: true,
},
},
];
```

View File

@ -47,6 +47,10 @@ function onAlertClosed() {
isConfirm.value = false;
}
function onEscapeKeyDown() {
isConfirm.value = false;
}
const getIconRender = computed(() => {
let iconRender: Component | null = null;
if (props.icon) {
@ -116,13 +120,11 @@ function handleCancel() {
const loading = ref(false);
async function handleOpenChange(val: boolean) {
const confirmState = isConfirm.value;
isConfirm.value = false;
await nextTick();
await nextTick(); // isConfirm
if (!val && props.beforeClose) {
loading.value = true;
try {
const res = await props.beforeClose({ isConfirm: confirmState });
const res = await props.beforeClose({ isConfirm: isConfirm.value });
if (res !== false) {
open.value = false;
}
@ -142,6 +144,7 @@ async function handleOpenChange(val: boolean) {
:overlay-blur="overlayBlur"
@opened="emits('opened')"
@closed="onAlertClosed"
@escape-key-down="onEscapeKeyDown"
:class="
cn(
containerClass,

View File

@ -41,7 +41,6 @@ watch(
innerValue.value.length > 0 ? innerValue.value[0] : undefined;
}
},
{ immediate: true },
);
watch(
@ -60,7 +59,7 @@ watch(
innerValue.value = val === undefined ? [] : [val as ValueType];
}
},
{ deep: true },
{ deep: true, immediate: true },
);
async function onBtnClick(value: ValueType) {

View File

@ -1,4 +1,6 @@
<script lang="ts" setup>
import { CircleX } from '@vben-core/icons';
import {
Select,
SelectContent,
@ -8,17 +10,33 @@ import {
} from '../../ui';
interface Props {
allowClear?: boolean;
class?: any;
options?: Array<{ label: string; value: string }>;
placeholder?: string;
}
const props = defineProps<Props>();
const props = withDefaults(defineProps<Props>(), {
allowClear: false,
});
const modelValue = defineModel<string>();
function handleClear() {
modelValue.value = undefined;
}
</script>
<template>
<Select>
<SelectTrigger :class="props.class">
<SelectValue :placeholder="placeholder" />
<Select v-model="modelValue">
<SelectTrigger :class="props.class" class="flex w-full items-center">
<SelectValue class="flex-auto text-left" :placeholder="placeholder" />
<CircleX
@pointerdown.stop
@click.stop.prevent="handleClear"
v-if="allowClear && modelValue"
data-clear-button
class="mr-1 size-4 cursor-pointer opacity-50 hover:opacity-100"
/>
</SelectTrigger>
<SelectContent>
<template v-for="item in options" :key="item.value">

View File

@ -148,7 +148,9 @@ const toolbarOptions = computed(() => {
icon: 'vxe-icon-search',
circle: true,
status: showSearchForm.value ? 'primary' : undefined,
title: $t('common.search'),
title: showSearchForm.value
? $t('common.hideSearchPanel')
: $t('common.showSearchPanel'),
};
// toolbarConfig.tools
const toolbarConfig: VxeGridPropTypes.ToolbarConfig = {

View File

@ -18,5 +18,7 @@
"delete": "Delete",
"create": "Create",
"yes": "Yes",
"no": "No"
"no": "No",
"showSearchPanel": "Show search panel",
"hideSearchPanel": "Hide search panel"
}

View File

@ -18,5 +18,7 @@
"delete": "删除",
"create": "新增",
"yes": "是",
"no": "否"
"no": "否",
"showSearchPanel": "显示搜索面板",
"hideSearchPanel": "隐藏搜索面板"
}