Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev
This commit is contained in:
commit
2e72181174
@ -90,30 +90,52 @@ import { h } from 'vue';
|
|||||||
import { globalShareState, IconPicker } from '@vben/common-ui';
|
import { globalShareState, IconPicker } from '@vben/common-ui';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
|
||||||
import {
|
const AutoComplete = defineAsyncComponent(
|
||||||
AutoComplete,
|
() => import('ant-design-vue/es/auto-complete'),
|
||||||
Button,
|
);
|
||||||
Checkbox,
|
const Button = defineAsyncComponent(() => import('ant-design-vue/es/button'));
|
||||||
CheckboxGroup,
|
const Checkbox = defineAsyncComponent(
|
||||||
DatePicker,
|
() => import('ant-design-vue/es/checkbox'),
|
||||||
Divider,
|
);
|
||||||
Input,
|
const CheckboxGroup = defineAsyncComponent(() =>
|
||||||
InputNumber,
|
import('ant-design-vue/es/checkbox').then((res) => res.CheckboxGroup),
|
||||||
InputPassword,
|
);
|
||||||
Mentions,
|
const DatePicker = defineAsyncComponent(
|
||||||
notification,
|
() => import('ant-design-vue/es/date-picker'),
|
||||||
Radio,
|
);
|
||||||
RadioGroup,
|
const Divider = defineAsyncComponent(() => import('ant-design-vue/es/divider'));
|
||||||
RangePicker,
|
const Input = defineAsyncComponent(() => import('ant-design-vue/es/input'));
|
||||||
Rate,
|
const InputNumber = defineAsyncComponent(
|
||||||
Select,
|
() => import('ant-design-vue/es/input-number'),
|
||||||
Space,
|
);
|
||||||
Switch,
|
const InputPassword = defineAsyncComponent(() =>
|
||||||
Textarea,
|
import('ant-design-vue/es/input').then((res) => res.InputPassword),
|
||||||
TimePicker,
|
);
|
||||||
TreeSelect,
|
const Mentions = defineAsyncComponent(
|
||||||
Upload,
|
() => import('ant-design-vue/es/mentions'),
|
||||||
} from 'ant-design-vue';
|
);
|
||||||
|
const Radio = defineAsyncComponent(() => import('ant-design-vue/es/radio'));
|
||||||
|
const RadioGroup = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/radio').then((res) => res.RadioGroup),
|
||||||
|
);
|
||||||
|
const RangePicker = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/date-picker').then((res) => res.RangePicker),
|
||||||
|
);
|
||||||
|
const Rate = defineAsyncComponent(() => import('ant-design-vue/es/rate'));
|
||||||
|
const Select = defineAsyncComponent(() => import('ant-design-vue/es/select'));
|
||||||
|
const Space = defineAsyncComponent(() => import('ant-design-vue/es/space'));
|
||||||
|
const Switch = defineAsyncComponent(() => import('ant-design-vue/es/switch'));
|
||||||
|
const Textarea = defineAsyncComponent(() =>
|
||||||
|
import('ant-design-vue/es/input').then((res) => res.Textarea),
|
||||||
|
);
|
||||||
|
const TimePicker = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/time-picker'),
|
||||||
|
);
|
||||||
|
const TreeSelect = defineAsyncComponent(
|
||||||
|
() => import('ant-design-vue/es/tree-select'),
|
||||||
|
);
|
||||||
|
const Upload = defineAsyncComponent(() => import('ant-design-vue/es/upload'));
|
||||||
|
|
||||||
|
|
||||||
const withDefaultPlaceholder = <T extends Component>(
|
const withDefaultPlaceholder = <T extends Component>(
|
||||||
component: T,
|
component: T,
|
||||||
|
|||||||
@ -30,7 +30,7 @@ function openWindow(url: string, options: OpenWindowOptions = {}): void {
|
|||||||
function openRouteInNewWindow(path: string) {
|
function openRouteInNewWindow(path: string) {
|
||||||
const { hash, origin } = location;
|
const { hash, origin } = location;
|
||||||
const fullPath = path.startsWith('/') ? path : `/${path}`;
|
const fullPath = path.startsWith('/') ? path : `/${path}`;
|
||||||
const url = `${origin}${hash ? '/#' : ''}${fullPath}`;
|
const url = `${origin}${hash && !fullPath.startsWith('/#') ? '/#' : ''}${fullPath}`;
|
||||||
openWindow(url, { target: '_blank' });
|
openWindow(url, { target: '_blank' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ const values = useFormValues();
|
|||||||
const errors = useFieldError(fieldName);
|
const errors = useFieldError(fieldName);
|
||||||
const fieldComponentRef = useTemplateRef<HTMLInputElement>('fieldComponentRef');
|
const fieldComponentRef = useTemplateRef<HTMLInputElement>('fieldComponentRef');
|
||||||
const formApi = formRenderProps.form;
|
const formApi = formRenderProps.form;
|
||||||
const compact = formRenderProps.compact;
|
const compact = computed(() => formRenderProps.compact);
|
||||||
const isInValid = computed(() => errors.value?.length > 0);
|
const isInValid = computed(() => errors.value?.length > 0);
|
||||||
|
|
||||||
const FieldComponent = computed(() => {
|
const FieldComponent = computed(() => {
|
||||||
|
|||||||
@ -29,7 +29,8 @@ function useNavigation() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const route = routeMetaMap.get(path);
|
const route = routeMetaMap.get(path);
|
||||||
return route?.meta?.openInNewWindow ?? false;
|
// 如果有外链或者设置了在新窗口打开,返回 true
|
||||||
|
return !!(route?.meta?.link || route?.meta?.openInNewWindow);
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveHref = (path: string): string => {
|
const resolveHref = (path: string): string => {
|
||||||
@ -39,7 +40,13 @@ function useNavigation() {
|
|||||||
const navigation = async (path: string) => {
|
const navigation = async (path: string) => {
|
||||||
try {
|
try {
|
||||||
const route = routeMetaMap.get(path);
|
const route = routeMetaMap.get(path);
|
||||||
const { openInNewWindow = false, query = {} } = route?.meta ?? {};
|
const { openInNewWindow = false, query = {}, link } = route?.meta ?? {};
|
||||||
|
|
||||||
|
// 检查是否有外链
|
||||||
|
if (link && typeof link === 'string') {
|
||||||
|
openWindow(link, { target: '_blank' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isHttpUrl(path)) {
|
if (isHttpUrl(path)) {
|
||||||
openWindow(path, { target: '_blank' });
|
openWindow(path, { target: '_blank' });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user