Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/_util/isServer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const isServer = typeof window === 'undefined';
5 changes: 3 additions & 2 deletions components/_util/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
return new Promise((resolve) => {
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/form/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
// formItem 的 span 属性,占据的列数
each(range(24), {
.@{form-item-cls}-span-@{value} {
grid-column: span @value / span @value;
grid-column: span @value;
}
});
}
Expand Down
2 changes: 2 additions & 0 deletions components/modal/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 8 additions & 1 deletion components/popper/usePopper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -27,7 +28,7 @@ export default (props: PopperProps, emit: any) => {
const popperRef = ref<HTMLElement>();
const arrowRef = ref<HTMLElement>();
const popperStyle = reactive({
zIndex: popupManager.nextZIndex(),
zIndex: isServer ? 2000 : popupManager.nextZIndex(),
});
const placement = ref(props.placement);
const cacheVisible = ref(true);
Expand All @@ -38,6 +39,9 @@ export default (props: PopperProps, emit: any) => {
});

const computePopper = () => {
if (isServer) {
return;
}
if (isBoolean(props.disabled) && props.disabled) {
return;
}
Expand All @@ -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) {
Expand Down