mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-01 10:47:57 +08:00
refactor(utils): remove isServer (#5173)
This commit is contained in:
parent
bf1f52b87e
commit
15ffab1255
@ -1,5 +1,5 @@
|
||||
import { computed, inject, unref } from 'vue'
|
||||
import isServer from '@element-plus/utils/isServer'
|
||||
import { isClient } from '@vueuse/core'
|
||||
import { debugWarn } from '@element-plus/utils/error'
|
||||
|
||||
import type { InjectionKey, Ref } from 'vue'
|
||||
@ -21,7 +21,7 @@ export const ID_INJECTION_KEY: InjectionKey<ElIdInjectionContext> =
|
||||
export const useId = (deterministicId?: MaybeRef<string>): Ref<string> => {
|
||||
const idInjection = inject(ID_INJECTION_KEY, defaultIdInjection)
|
||||
|
||||
if (isServer && idInjection === defaultIdInjection) {
|
||||
if (!isClient && idInjection === defaultIdInjection) {
|
||||
debugWarn(
|
||||
'IdInjection',
|
||||
`Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { onBeforeMount } from 'vue'
|
||||
import { isClient } from '@vueuse/core'
|
||||
import { generateId } from '@element-plus/utils/util'
|
||||
import isServer from '@element-plus/utils/isServer'
|
||||
|
||||
let cachedContainer: HTMLElement
|
||||
|
||||
@ -10,7 +10,7 @@ export const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`
|
||||
|
||||
export const usePopperContainer = () => {
|
||||
onBeforeMount(() => {
|
||||
if (isServer) return
|
||||
if (!isClient) return
|
||||
|
||||
// This is for bypassing the error that when under testing env, we often encounter
|
||||
// document.body.innerHTML = '' situation
|
||||
|
@ -1 +0,0 @@
|
||||
export default !(globalThis ? globalThis.document : window)
|
Loading…
Reference in New Issue
Block a user