Skip to content

Commit

Permalink
修复某些情况下document.body为null时报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gujixiang committed Aug 2, 2024
1 parent 3fa4dd5 commit 8fa2045
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/convert-px.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { canUseDom } from './can-use-dom'
import { isDev } from './is-dev'
import { devError } from './dev-log'
import { isDev } from './is-dev'

let tenPxTester: HTMLDivElement | null = null
let tester: HTMLDivElement | null = null

if (canUseDom) {
if (canUseDom && document.body) {
tenPxTester = document.createElement('div')
tenPxTester.className = 'adm-px-tester'
tenPxTester.style.setProperty('--size', '10')
Expand Down

0 comments on commit 8fa2045

Please sign in to comment.