xctc-utils 1.6.62 → 1.6.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  // npm publish
5
5
 
6
6
  // ts-node app.ts
7
+ // npm install -g cnpm --registry=https://registry.npmmirror.com
7
8
 
8
9
  import {formatTimeStamp,formatStrTime} from "./src/time"
9
10
  import {decrypt,encrypt} from "./src/crypto"
@@ -1,4 +1,6 @@
1
1
  export default class CanvasHooks {
2
+ fabricSource: any;
3
+ fabricUrlSource: string;
2
4
  canvasDataSource: any;
3
5
  zoomDataSource: string;
4
6
  dragLastPosDataSource: any;
@@ -11,7 +11,6 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- var fabric_1 = require("fabric");
15
14
  var config_1 = require("../config");
16
15
  var utils_1 = require("../utils");
17
16
  var is_1 = require("../is");
@@ -33,6 +32,8 @@ var index_2 = require("../event/index");
33
32
  var defaultConfig = __assign({}, config_1.configDefaultValue.canvasDefaultValue);
34
33
  var CanvasHooks = /** @class */ (function () {
35
34
  function CanvasHooks(config) {
35
+ this.fabricSource = null;
36
+ this.fabricUrlSource = "https://cdn.jsdelivr.net/npm/fabric";
36
37
  this.canvasDataSource = null;
37
38
  this.zoomDataSource = "100";
38
39
  this.canvasBackgroundImageTarget = null;
@@ -76,6 +77,7 @@ var CanvasHooks = /** @class */ (function () {
76
77
  });
77
78
  // 创建画布
78
79
  CanvasHooks.prototype.createCanvasFn = function (config) {
80
+ var _a;
79
81
  var _ = this;
80
82
  _.renderCanvasStatus = 1;
81
83
  var canvasId = "";
@@ -102,76 +104,87 @@ var CanvasHooks = /** @class */ (function () {
102
104
  var imgUrl = (data === null || data === void 0 ? void 0 : data.backgroundImgUrl) || "";
103
105
  console.log("canvas--options", data);
104
106
  canvasId = data.id;
105
- if (imgUrl) {
106
- fabric_1.fabric.Image.fromURL(imgUrl, function (img) {
107
- _.renderCanvasStatus = 2;
108
- _.canvasBackgroundImageTarget = img;
109
- var _a = _.canvasConfig.actions, actions = _a === void 0 ? "" : _a;
110
- var zoomValue = (actions === null || actions === void 0 ? void 0 : actions.zoom) || 1;
111
- if (!_.canvasDataSource) {
112
- _.canvasDataSource = new fabric_1.fabric.Canvas(canvasId, __assign({}, data));
113
- if (zoomValue != 1) {
114
- _.canvasDataSource.setZoom(zoomValue);
115
- }
116
- }
117
- var canvasWidth = _.canvasDataSource.getWidth();
118
- var canvasHeight = _.canvasDataSource.getHeight();
119
- var imgWidth = img.width;
120
- var imgHeight = img.height;
121
- var scaleX = 1;
122
- var scaleY = 1;
123
- if (canvasWidth && canvasHeight && imgWidth && imgHeight) {
124
- var imageAspectRatio = imgWidth / imgHeight;
125
- var canvasAspectRatio = canvasWidth / canvasHeight;
126
- if (imageAspectRatio > canvasAspectRatio) {
127
- // 图片更宽,基于高度缩放
128
- scaleY = canvasHeight / imgHeight;
129
- scaleX = scaleY * imageAspectRatio;
107
+ var url = _.fabricUrlSource;
108
+ if ((_a = _.canvasConfig) === null || _a === void 0 ? void 0 : _a.fabricUrlSource) {
109
+ url = _.canvasConfig.fabricUrlSource;
110
+ }
111
+ if (config === null || config === void 0 ? void 0 : config.fabricUrlSource) {
112
+ url = config.fabricUrlSource;
113
+ }
114
+ (0, utils_1.loadScript)(url, function () {
115
+ var win = window;
116
+ _.fabricSource = (win === null || win === void 0 ? void 0 : win.fabric) || {};
117
+ if (imgUrl) {
118
+ _.fabricSource.Image.fromURL(imgUrl, function (img) {
119
+ _.renderCanvasStatus = 2;
120
+ _.canvasBackgroundImageTarget = img;
121
+ var _a = _.canvasConfig.actions, actions = _a === void 0 ? "" : _a;
122
+ var zoomValue = (actions === null || actions === void 0 ? void 0 : actions.zoom) || 1;
123
+ if (!_.canvasDataSource) {
124
+ _.canvasDataSource = new _.fabricSource.Canvas(canvasId, __assign({}, data));
125
+ if (zoomValue != 1) {
126
+ _.canvasDataSource.setZoom(zoomValue);
127
+ }
130
128
  }
131
- else {
132
- // 图片更高或宽高比相同,基于宽度缩放
133
- scaleX = canvasWidth / imgWidth;
134
- scaleY = scaleX / imageAspectRatio;
129
+ var canvasWidth = _.canvasDataSource.getWidth();
130
+ var canvasHeight = _.canvasDataSource.getHeight();
131
+ var imgWidth = img.width;
132
+ var imgHeight = img.height;
133
+ var scaleX = 1;
134
+ var scaleY = 1;
135
+ if (canvasWidth && canvasHeight && imgWidth && imgHeight) {
136
+ var imageAspectRatio = imgWidth / imgHeight;
137
+ var canvasAspectRatio = canvasWidth / canvasHeight;
138
+ if (imageAspectRatio > canvasAspectRatio) {
139
+ // 图片更宽,基于高度缩放
140
+ scaleY = canvasHeight / imgHeight;
141
+ scaleX = scaleY * imageAspectRatio;
142
+ }
143
+ else {
144
+ // 图片更高或宽高比相同,基于宽度缩放
145
+ scaleX = canvasWidth / imgWidth;
146
+ scaleY = scaleX / imageAspectRatio;
147
+ }
135
148
  }
136
- }
137
- console.log("原始比例:", { scaleX: scaleX, scaleY: scaleY, width: imgWidth, height: imgHeight });
138
- _.canvasDataSource.setBackgroundImage(img, _.canvasDataSource.renderAll.bind(_.canvasDataSource), {
139
- originX: 'left',
140
- originY: 'top',
141
- left: 0,
142
- top: 0,
143
- // scaleX: scaleX,
144
- // scaleY: scaleY,
145
- width: imgWidth,
146
- height: imgHeight,
149
+ console.log("原始比例:", { scaleX: scaleX, scaleY: scaleY, width: imgWidth, height: imgHeight });
150
+ _.canvasDataSource.setBackgroundImage(img, _.canvasDataSource.renderAll.bind(_.canvasDataSource), {
151
+ originX: 'left',
152
+ originY: 'top',
153
+ left: 0,
154
+ top: 0,
155
+ // scaleX: scaleX,
156
+ // scaleY: scaleY,
157
+ width: imgWidth,
158
+ height: imgHeight,
159
+ });
160
+ _.renderCanvasStatus = 3;
161
+ _.registerAllEventHandleFn();
162
+ _.canvasDataSource.renderAll();
163
+ callBack(_.canvasDataSource);
147
164
  });
148
- _.renderCanvasStatus = 3;
149
- _.registerAllEventHandleFn();
150
- _.canvasDataSource.renderAll();
151
- callBack(_.canvasDataSource);
152
- });
153
- }
154
- else {
155
- if (!_.canvasDataSource) {
156
- _.canvasDataSource = new fabric_1.fabric.Canvas(canvasId, __assign({}, data));
157
- _.renderCanvasStatus = 3;
158
- _.registerAllEventHandleFn();
159
- _.canvasDataSource.renderAll();
160
- callBack(_.canvasDataSource);
161
165
  }
162
- }
163
- // 如果配置里面有回调函数,则将当前画布数据对象返回
164
- function callBack(data) {
165
- var _a;
166
- var cb = ((_a = _.canvasConfig) === null || _a === void 0 ? void 0 : _a.cb) || "";
167
- // 获取DOM元素
168
- var targetElement = (0, utils_1.getDomFn)("canvasContainer");
169
- // 添加事件监听器
170
- document.addEventListener('mousemove', (0, index_2.checkMouseInElement)(targetElement));
171
- if (cb instanceof Function) {
172
- cb(data);
166
+ else {
167
+ if (!_.canvasDataSource) {
168
+ _.canvasDataSource = new _.fabricSource.Canvas(canvasId, __assign({}, data));
169
+ _.renderCanvasStatus = 3;
170
+ _.registerAllEventHandleFn();
171
+ _.canvasDataSource.renderAll();
172
+ callBack(_.canvasDataSource);
173
+ }
173
174
  }
174
- }
175
+ // 如果配置里面有回调函数,则将当前画布数据对象返回
176
+ function callBack(data) {
177
+ var _a;
178
+ var cb = ((_a = _.canvasConfig) === null || _a === void 0 ? void 0 : _a.cb) || "";
179
+ // 获取DOM元素
180
+ var targetElement = (0, utils_1.getDomFn)("canvasContainer");
181
+ // 添加事件监听器
182
+ document.addEventListener('mousemove', (0, index_2.checkMouseInElement)(targetElement));
183
+ if (cb instanceof Function) {
184
+ cb(data);
185
+ }
186
+ }
187
+ });
175
188
  };
176
189
  // 销毁画布
177
190
  CanvasHooks.prototype.disposeCanvasFn = function () {
@@ -1,4 +1,4 @@
1
- import CryptoJS from "crypto-js";
2
- export declare const cryptojs: typeof CryptoJS;
1
+ export declare const loadCryptoJs: (url?: string, callback?: any) => void;
2
+ export declare const cryptojs: any;
3
3
  export declare function encrypt(word: any, key?: any, iv?: any): any;
4
4
  export declare function decrypt(word: any, key?: any, iv?: any): any;
@@ -1,18 +1,30 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.decrypt = exports.encrypt = exports.cryptojs = void 0;
7
- var crypto_js_1 = __importDefault(require("crypto-js"));
3
+ exports.decrypt = exports.encrypt = exports.cryptojs = exports.loadCryptoJs = void 0;
8
4
  var utils_1 = require("../utils");
5
+ var utils_2 = require("../utils");
6
+ var cryptoUrl = "https://unpkg.com/crypto-js@4.1.1/index.js";
7
+ var cryptoJsSource = "";
8
+ var loadCryptoJs = function (url, callback) {
9
+ var win = window;
10
+ if (url) {
11
+ cryptoUrl = url;
12
+ }
13
+ (0, utils_2.loadScript)(cryptoUrl, function () {
14
+ cryptoJsSource = (win === null || win === void 0 ? void 0 : win.CryptoJS) || "";
15
+ if (typeof callback === "function") {
16
+ callback();
17
+ }
18
+ });
19
+ };
20
+ exports.loadCryptoJs = loadCryptoJs;
9
21
  function formatVal(val) {
10
22
  var key = "5uMz4R8r0926DkC8";
11
23
  if (val)
12
24
  key = val;
13
- return crypto_js_1.default.enc.Utf8.parse(key);
25
+ return cryptoJsSource.enc.Utf8.parse(key);
14
26
  }
15
- exports.cryptojs = crypto_js_1.default;
27
+ exports.cryptojs = cryptoJsSource;
16
28
  // 加密
17
29
  function encrypt(word, key, iv) {
18
30
  if (!word) {
@@ -24,12 +36,12 @@ function encrypt(word, key, iv) {
24
36
  }
25
37
  // key //十六位十六进制数作为密钥
26
38
  // iv 十六位十六进制数作为密钥偏移量
27
- var src = crypto_js_1.default.enc.Utf8.parse(word);
39
+ var src = cryptoJsSource.enc.Utf8.parse(word);
28
40
  key = formatVal(key);
29
41
  iv = formatVal(iv);
30
42
  var encryptedData = "";
31
43
  try {
32
- var encrypted = crypto_js_1.default.AES.encrypt(src, key, { iv: iv, mode: crypto_js_1.default.mode.CBC, padding: crypto_js_1.default.pad.Pkcs7 });
44
+ var encrypted = cryptoJsSource.AES.encrypt(src, key, { iv: iv, mode: cryptoJsSource.mode.CBC, padding: cryptoJsSource.pad.Pkcs7 });
33
45
  encryptedData = encrypted.ciphertext.toString().toUpperCase();
34
46
  }
35
47
  catch (error) {
@@ -47,12 +59,12 @@ function decrypt(word, key, iv) {
47
59
  }
48
60
  key = formatVal(key);
49
61
  iv = formatVal(iv);
50
- var encryptedHexStr = crypto_js_1.default.enc.Hex.parse(word);
51
- var src = crypto_js_1.default.enc.Base64.stringify(encryptedHexStr);
62
+ var encryptedHexStr = cryptoJsSource.enc.Hex.parse(word);
63
+ var src = cryptoJsSource.enc.Base64.stringify(encryptedHexStr);
52
64
  var decryptedData = "";
53
65
  try {
54
- var decrypt_1 = crypto_js_1.default.AES.decrypt(src, key, { iv: iv, mode: crypto_js_1.default.mode.CBC, padding: crypto_js_1.default.pad.Pkcs7 });
55
- var decryptedStr = decrypt_1.toString(crypto_js_1.default.enc.Utf8);
66
+ var decrypt_1 = cryptoJsSource.AES.decrypt(src, key, { iv: iv, mode: cryptoJsSource.mode.CBC, padding: cryptoJsSource.pad.Pkcs7 });
67
+ var decryptedStr = decrypt_1.toString(cryptoJsSource.enc.Utf8);
56
68
  decryptedData = decryptedStr.toString();
57
69
  }
58
70
  catch (error) {
@@ -1,4 +1,3 @@
1
- export declare const xx: {};
2
1
  export declare function CreateDragElementFn(): void;
3
2
  export declare function InitElement2CanvasFn(list: any[]): void;
4
3
  export declare function CreateCanvasSvgElementFn(item: any, index?: number): void;
@@ -11,11 +11,9 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.CreateElementFn = exports.CreateRightClickMenuFn = exports.CreateAllSelectionRectFn = exports.CreateSelectionRectFn = exports.CreateCanvasImageElementFn = exports.CreateCanvasSvgElementFn = exports.InitElement2CanvasFn = exports.CreateDragElementFn = exports.xx = void 0;
14
+ exports.CreateElementFn = exports.CreateRightClickMenuFn = exports.CreateAllSelectionRectFn = exports.CreateSelectionRectFn = exports.CreateCanvasImageElementFn = exports.CreateCanvasSvgElementFn = exports.InitElement2CanvasFn = exports.CreateDragElementFn = void 0;
15
15
  var utils_1 = require("../utils");
16
16
  var is_1 = require("../is");
17
- var fabric_1 = require("fabric");
18
- exports.xx = {};
19
17
  function CreateDragElementFn() {
20
18
  var _a, _b, _c, _d, _e;
21
19
  var _ = this;
@@ -64,6 +62,7 @@ function InitElement2CanvasFn(list) {
64
62
  }
65
63
  });
66
64
  }
65
+ _.defaultCreateDataListStatus = true;
67
66
  }
68
67
  exports.InitElement2CanvasFn = InitElement2CanvasFn;
69
68
  function CreateCanvasSvgElementFn(item, index) {
@@ -75,7 +74,7 @@ function CreateCanvasSvgElementFn(item, index) {
75
74
  return;
76
75
  }
77
76
  var createDragElementBackFn = (_.callBackEventConfig || {}).createDragElementBackFn;
78
- fabric_1.fabric.loadSVGFromURL(item === null || item === void 0 ? void 0 : item.address, function (objects) {
77
+ _.fabricSource.loadSVGFromURL(item === null || item === void 0 ? void 0 : item.address, function (objects) {
79
78
  var svgObject = (objects === null || objects === void 0 ? void 0 : objects.length) ? objects[0] : "";
80
79
  if (!svgObject) {
81
80
  return;
@@ -106,7 +105,7 @@ function CreateCanvasImageElementFn(item, index) {
106
105
  return;
107
106
  }
108
107
  var createDragElementBackFn = (_.callBackEventConfig || {}).createDragElementBackFn;
109
- fabric_1.fabric.Image.fromURL((_a = _.dragElementDataSource) === null || _a === void 0 ? void 0 : _a.address, function (img) {
108
+ _.fabricSource.Image.fromURL((_a = _.dragElementDataSource) === null || _a === void 0 ? void 0 : _a.address, function (img) {
110
109
  img.set(__assign({}, item));
111
110
  _.canvasDataSource.add(img);
112
111
  _.canvasCreateElementsDataSource.push(img);
@@ -133,7 +132,7 @@ function CreateSelectionRectFn() {
133
132
  if (!_.canvasDataSource) {
134
133
  return;
135
134
  }
136
- _.createSelectionRectDataSource = new fabric_1.fabric.Rect({
135
+ _.createSelectionRectDataSource = new _.fabricSource.Rect({
137
136
  left: (_a = _.mousePointerDataSource) === null || _a === void 0 ? void 0 : _a.x,
138
137
  top: (_b = _.mousePointerDataSource) === null || _b === void 0 ? void 0 : _b.y,
139
138
  width: 0,
@@ -162,7 +161,7 @@ function CreateAllSelectionRectFn() {
162
161
  // console.log("xxx---",_.canvasDataSource.getWidth());
163
162
  var containerWidth = container.offsetWidth;
164
163
  var containerHeight = container.offsetWidth;
165
- _.createSelectionRectDataSource = new fabric_1.fabric.Rect({
164
+ _.createSelectionRectDataSource = new _.fabricSource.Rect({
166
165
  left: 0,
167
166
  top: 0,
168
167
  width: _.canvasDataSource.getWidth(),
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { UeditorHeightOption } from "./types";
2
2
  export declare function isMobile(): boolean;
3
+ export declare function loadScript(url: string, callback?: any): void;
3
4
  /**
4
5
  * 判断当前传入的字符串是否为 json格式 字符串
5
6
  * @param str
package/dist/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleCopyValue = exports.weixinBrowser = exports.deviceEnvironment = exports.getIframeContentHeight = exports.checkIframeContentHeight = exports.getDomFn = exports.isJson = exports.isMobile = void 0;
3
+ exports.handleCopyValue = exports.weixinBrowser = exports.deviceEnvironment = exports.getIframeContentHeight = exports.checkIframeContentHeight = exports.getDomFn = exports.isJson = exports.loadScript = exports.isMobile = void 0;
4
4
  var is_1 = require("./is");
5
5
  var win = window;
6
6
  // 是否是手机端环境
@@ -10,6 +10,30 @@ function isMobile() {
10
10
  return isPhone;
11
11
  }
12
12
  exports.isMobile = isMobile;
13
+ function loadScript(url, callback) {
14
+ if (!url) {
15
+ return;
16
+ }
17
+ var script = document.createElement('script');
18
+ script.type = 'text/javascript';
19
+ if (script === null || script === void 0 ? void 0 : script.readyState) { // IE
20
+ script.onreadystatechange = function () {
21
+ if (script.readyState === 'loaded' || script.readyState === 'complete') {
22
+ script.onreadystatechange = null;
23
+ callback();
24
+ }
25
+ };
26
+ }
27
+ else { // Others
28
+ script.onload = function () {
29
+ callback();
30
+ };
31
+ }
32
+ script.src = url;
33
+ var head = document.getElementsByTagName('head')[0];
34
+ head.appendChild(script);
35
+ }
36
+ exports.loadScript = loadScript;
13
37
  /**
14
38
  * 判断当前传入的字符串是否为 json格式 字符串
15
39
  * @param str
@@ -13,6 +13,7 @@ interface configOption {
13
13
  debuggerStatus?: boolean;
14
14
  cb?: any;
15
15
  }
16
+ export declare function loadWeiXinSDK(url?: string, callback?: any): void;
16
17
  export declare function getUrlCode(config: configOption): void;
17
18
  export declare function envSDK(): any;
18
19
  export declare function getCode(appId?: string, scope?: string): void;
@@ -23,19 +23,35 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.onlinePay = exports.shareReady = exports.configReady = exports.getCode = exports.envSDK = exports.getUrlCode = void 0;
26
+ exports.onlinePay = exports.shareReady = exports.configReady = exports.getCode = exports.envSDK = exports.getUrlCode = exports.loadWeiXinSDK = void 0;
27
27
  // import * as weixin from 'weixin-js-sdk' // 引入微信SDK
28
- var weixin = require("weixin-js-sdk");
28
+ // const weixin = require("weixin-js-sdk")
29
29
  var utils_1 = require("../utils");
30
30
  var crypto_1 = require("../crypto");
31
31
  var params = __importStar(require("../params"));
32
32
  var is_1 = require("../is");
33
33
  var index_1 = require("../storage/index");
34
+ var utils_2 = require("../utils");
34
35
  var w = window;
35
36
  var loc = w.location;
36
37
  var defaultKey = "5uMz4R8r0926DkC8";
37
38
  var defaultIv = "5uMz4R8r0926DkC8";
38
39
  var weixinConfig = {};
40
+ var weixinUrl = "https://res.wx.qq.com/open/js/jweixin-1.6.0.js";
41
+ var weixinJsSource = "";
42
+ function loadWeiXinSDK(url, callback) {
43
+ var win = window;
44
+ if (url) {
45
+ weixinUrl = url;
46
+ }
47
+ (0, utils_2.loadScript)(weixinUrl, function () {
48
+ weixinJsSource = (win === null || win === void 0 ? void 0 : win.wx) || "";
49
+ if (typeof callback === "function") {
50
+ callback();
51
+ }
52
+ });
53
+ }
54
+ exports.loadWeiXinSDK = loadWeiXinSDK;
39
55
  function getUrlCode(config) {
40
56
  var _a;
41
57
  if (!(0, utils_1.weixinBrowser)()) {
@@ -258,7 +274,12 @@ function initSdk() {
258
274
  wx = w.wx;
259
275
  }
260
276
  else {
261
- wx = weixin;
277
+ if (!weixinJsSource) {
278
+ console.error("请先调用函数:loadWeiXinSDK");
279
+ }
280
+ else {
281
+ wx = weixinJsSource;
282
+ }
262
283
  }
263
284
  w['weixinConfig'] = wx;
264
285
  return wx;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.6.62",
3
+ "private": false,
4
+ "version": "1.6.64",
4
5
  "description": "localStorage存储\r ```\r sessionStorage存储\r ```\r crypto-js加密、解密\r ```\r 微信授权登录、微信分享\r ```\r 设备环境获取\r ```\r 是否是微信浏览器\r ```\r 时间戳转时间,字符串转时间戳",
5
6
  "main": "./dist/index.js",
6
7
  "types": "./dist/index.d.ts",
@@ -9,17 +10,14 @@
9
10
  "prepublish": "npm run build",
10
11
  "build": "tsc"
11
12
  },
12
- "author": "",
13
+ "author": "dyb",
13
14
  "license": "ISC",
14
15
  "devDependencies": {
15
- "@types/crypto-js": "^4.1.1",
16
16
  "@types/node": "^18.11.19",
17
17
  "typescript": "^4.9.5"
18
18
  },
19
19
  "dependencies": {
20
- "crypto-js": "^4.1.1",
21
- "fabric": "^5.3.0",
22
- "weixin-js-sdk": "^1.6.0"
20
+
23
21
  },
24
22
  "repository": {
25
23
  "type": "git",
@@ -1 +0,0 @@
1
- export declare function isMobile(): boolean;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isMobile = void 0;
4
- var w = window;
5
- // 是否是手机端环境
6
- function isMobile() {
7
- var info = w.navigator.userAgent;
8
- var isPhone = /mobile/i.test(info);
9
- return isPhone;
10
- }
11
- exports.isMobile = isMobile;