diff --git a/components/_util/isServer.ts b/components/_util/isServer.ts new file mode 100644 index 000000000..df6bd5693 --- /dev/null +++ b/components/_util/isServer.ts @@ -0,0 +1 @@ +export const isServer = typeof window === 'undefined'; diff --git a/components/_util/utils.ts b/components/_util/utils.ts index 0b174c442..3bf1fca93 100644 --- a/components/_util/utils.ts +++ b/components/_util/utils.ts @@ -4,7 +4,8 @@ import { isFinite, isNull, isString, isUndefined } from 'lodash-es'; export const noop = () => {}; export const noopInNoop = () => noop; -export const defaultContainer = () => document.body; +export const defaultContainer = () => + typeof document !== 'undefined' ? document.body : null; export async function sleep(ms: number): Promise { return new Promise((resolve) => { @@ -148,7 +149,7 @@ export function getScrollParent( const { overflow, overflowX, overflowY } = getComputedStyle( parentNode as HTMLElement, ); - if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { + if (/auto|scroll|overlay/.test(overflow + overflowY + overflowX)) { return parentNode as HTMLElement; } } diff --git a/components/form/style/index.less b/components/form/style/index.less index 86f4d312d..ea28ad120 100644 --- a/components/form/style/index.less +++ b/components/form/style/index.less @@ -102,7 +102,7 @@ // formItem 的 span 属性,占据的列数 each(range(24), { .@{form-item-cls}-span-@{value} { - grid-column: span @value / span @value; + grid-column: span @value; } }); } diff --git a/components/modal/style/index.less b/components/modal/style/index.less index 2171748ce..5cc5157ba 100644 --- a/components/modal/style/index.less +++ b/components/modal/style/index.less @@ -130,6 +130,8 @@ padding: @padding-xs 0; color: var(--f-sub-head-color); font-size: var(--f-font-size-base); + overflow: hidden; + word-break: break-all; } &-footer { diff --git a/components/popper/usePopper.ts b/components/popper/usePopper.ts index c64d19606..51fe567b9 100644 --- a/components/popper/usePopper.ts +++ b/components/popper/usePopper.ts @@ -4,6 +4,7 @@ import { isBoolean, isFunction } from 'lodash-es'; import { useVModel } from '@vueuse/core'; import popupManager from '../_util/popupManager'; import getElementFromVueInstance from '../_util/getElementFromVueInstance'; +import { isServer } from '../_util/isServer'; import type { PopperProps } from './props'; import type { VirtualRect } from './interface'; @@ -27,7 +28,7 @@ export default (props: PopperProps, emit: any) => { const popperRef = ref(); const arrowRef = ref(); const popperStyle = reactive({ - zIndex: popupManager.nextZIndex(), + zIndex: isServer ? 2000 : popupManager.nextZIndex(), }); const placement = ref(props.placement); const cacheVisible = ref(true); @@ -38,6 +39,9 @@ export default (props: PopperProps, emit: any) => { }); const computePopper = () => { + if (isServer) { + return; + } if (isBoolean(props.disabled) && props.disabled) { return; } @@ -51,6 +55,9 @@ export default (props: PopperProps, emit: any) => { nextTick(() => { const rawTriggerEl = getElementFromVueInstance(triggerRef.value); + if (!rawTriggerEl) { + return; + } const triggerRect = rawTriggerEl.getBoundingClientRect(); // trigger 不可见的时候立即隐藏,允许误差 if (triggerRect.width <= 1 && triggerRect.height <= 1) {