mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
feat(util): 修改isPage函数定义
This commit is contained in:
parent
0491487385
commit
b9d4e8c66c
@ -19,7 +19,7 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import utc from 'dayjs/plugin/utc';
|
import utc from 'dayjs/plugin/utc';
|
||||||
|
|
||||||
import type { MNode } from '@tmagic/schema';
|
import type { MComponent, MNode } from '@tmagic/schema';
|
||||||
import { NodeType } from '@tmagic/schema';
|
import { NodeType } from '@tmagic/schema';
|
||||||
|
|
||||||
export * from './dom';
|
export * from './dom';
|
||||||
@ -126,9 +126,9 @@ export const getUrlParam = (param: string, url?: string) => {
|
|||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isPop = (node: MNode): boolean => Boolean(node.type?.toLowerCase().endsWith('pop'));
|
export const isPop = (node: MComponent | null): boolean => Boolean(node?.type?.toLowerCase().endsWith('pop'));
|
||||||
|
|
||||||
export const isPage = (node: MNode | undefined): boolean => {
|
export const isPage = (node?: MComponent | null): boolean => {
|
||||||
if (!node) return false;
|
if (!node) return false;
|
||||||
return Boolean(node.type?.toLowerCase() === NodeType.PAGE);
|
return Boolean(node.type?.toLowerCase() === NodeType.PAGE);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user