MinJieLiu 5 年之前
父節點
當前提交
6cf548eca8
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      package.json
  2. 1 1
      src/utils/isTouchDevice.ts

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "react-photo-view",
-  "version": "0.3.10",
+  "version": "0.3.11",
   "description": "一款精致的 React 的图片预览组件",
   "author": "MinJieLiu",
   "license": "MIT",

+ 1 - 1
src/utils/isTouchDevice.ts

@@ -1,6 +1,6 @@
 /**
  * 是否支持触摸设备
  */
-const isTouchDevice = 'ontouchstart' in document.documentElement;
+const isTouchDevice = typeof document !== 'undefined' && 'ontouchstart' in document.documentElement;
 
 export default isTouchDevice;