Browse Source

feat:ui test

wanghao 1 month ago
parent
commit
510370d73b
1 changed files with 7 additions and 13 deletions
  1. 7 13
      obui/app/scripts/components/node-details.js

+ 7 - 13
obui/app/scripts/components/node-details.js

@@ -1,5 +1,5 @@
 import debug from 'debug';
-import React,{useEffect} from 'react';
+import React from 'react';
 import classNames from 'classnames';
 import PropTypes from 'prop-types';
 import { connect } from 'react-redux';
@@ -89,18 +89,9 @@ class NodeDetails extends React.Component {
         total:0,
         current:1,
       }
-    },
-    // ui test
-    useEffect(() => {
-      console.log(123456789,'useEffect')
-      //当url路径在xxx路径下时
-      if (window.location.pathname?.includes('xxx')) {
-        //执行特定操作
-      }
-    }, [window.location.pathname]);
+    }
   }
 
-
   handleClickClose = (ev) => {
     ev.preventDefault();
     this.props.clickCloseDetails(this.props.nodeId);
@@ -114,7 +105,6 @@ class NodeDetails extends React.Component {
     // 在这里执行你需要的清理工作
     this.props.clickCloseDetails(this.props.nodeId);
   };
-
   componentDidMount() {
     let _this = this
     // //上线时打开开始
@@ -229,9 +219,13 @@ class NodeDetails extends React.Component {
     });
     return json;
   }
+  // ui test
+  componentWillMount(){
+    window.addEventListener('beforeunload',this.handleBeforeUnload)
+  }
   componentWillUnmount() {
     console.log(2222222222222,'componentWillUnmount')
-    window.addEventListener('beforeunload', this.handleBeforeUnload);
+     window.removeEventListener('beforeunload', this.handleBeforeUnload);
     clearTimeout(this.timeoutId);
     resetDocumentTitle();
   }