From 2fefa42564ca6007a7c4613181bed7bc0d93e930 Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Fri, 03 Dec 2021 17:26:50 +0800
Subject: [PATCH] 优化导航组件

---
 common/Tools.js |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/common/Tools.js b/common/Tools.js
index 476235e..e4e7403 100644
--- a/common/Tools.js
+++ b/common/Tools.js
@@ -28,7 +28,11 @@
      * @param {String} [search]
      * @return {String|Null}
      */
-    static getUrlParam(name, search = window.location.search) {
+    static getUrlParam(name, search) {
+        if (process.env.TARO_ENV === 'weapp') {
+            return null;
+        }
+        search = search || window.location.search;
         const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
         const r = search.substr(1).match(reg);
         if (r !== null) {
@@ -119,12 +123,21 @@
     }
 
     /**
+     * 判断是否为未定义
+     * @param {*} data
+     * @return {Boolean}
+     */
+    static isUndefined(data) {
+        return Object.prototype.toString.call(data) === '[object Undefined]';
+    }
+
+    /**
      * 判断是否为 null
      * @param {*} data
      * @return {Boolean}
      */
     static isNull(data) {
-        return data === null;
+        return Object.prototype.toString.call(data) === '[object Null]';
     }
 
     /**
@@ -348,7 +361,7 @@
         if (minutes) {
             words = minutes + '分' + words;
         }
-        const hours = duration.get('hours');
+        const hours = parseInt(duration.as('hours'));
         if (hours) {
             words = hours + '小时' + words;
         }

--
Gitblit v1.9.1