Skip to content
  • Projects
  • Groups
  • Snippets
  • Help

ds147000 / react-project-storage

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • react-project-storage
  • src
  • router
  • guards.js
  • GGbong's avatar
    基础配置 · 473da7a9
    GGbong committed Jul 22, 2020
    473da7a9 Browse Directory
guards.js 437 Bytes
BlameHistoryPermalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import React from 'react'
import { show, hide } from 'loading-bar' 

// 路由守卫
export const Guards = (Page) => {
    return class extends React.Component {
        
        /** 进入页面 */
        componentDidMount() {
            hide()
        }
        /** 离开页面 */
        componentWillUnmount() {
            show()
        }
        
        render() {
            return <Page {...this.props} />
        }
    }
}