mirror of
https://github.com/YMFE/yapi.git
synced 2025-03-13 14:26:50 +08:00
fix: 接口 集合tab切换
This commit is contained in:
parent
4984e5eb0a
commit
4f095094c5
@ -2,6 +2,7 @@ import React, { Component } from 'react'
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Row, Col, Tabs } from 'antd';
|
import { Row, Col, Tabs } from 'antd';
|
||||||
import { Route, Switch, matchPath } from 'react-router-dom';
|
import { Route, Switch, matchPath } from 'react-router-dom';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import './interface.scss'
|
import './interface.scss'
|
||||||
|
|
||||||
@ -40,12 +41,19 @@ InterfaceRoute.propTypes = {
|
|||||||
match: PropTypes.object
|
match: PropTypes.object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@connect(
|
||||||
|
state => {
|
||||||
|
return {
|
||||||
|
isShowCol: state.interfaceCol.isShowCol
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
class Interface extends Component {
|
class Interface extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
match: PropTypes.object,
|
match: PropTypes.object,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
location: PropTypes.object
|
location: PropTypes.object,
|
||||||
|
isShowCol: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -57,6 +65,9 @@ class Interface extends Component {
|
|||||||
|
|
||||||
onChange = (action) => {
|
onChange = (action) => {
|
||||||
let params = this.props.match.params;
|
let params = this.props.match.params;
|
||||||
|
if(action === 'colOrCase') {
|
||||||
|
action = this.props.isShowCol ? 'col' : 'case';
|
||||||
|
}
|
||||||
this.props.history.push('/project/' + params.id + '/interface/' + action)
|
this.props.history.push('/project/' + params.id + '/interface/' + action)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +78,7 @@ class Interface extends Component {
|
|||||||
<Row gutter={16} >
|
<Row gutter={16} >
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<div className="left-menu">
|
<div className="left-menu">
|
||||||
<Tabs type="card" activeKey={activeKey} onChange={() => this.onChange(action)}>
|
<Tabs type="card" activeKey={activeKey} onChange={this.onChange}>
|
||||||
<Tabs.TabPane tab="接口列表" key="api">
|
<Tabs.TabPane tab="接口列表" key="api">
|
||||||
<InterfaceMenu router={matchPath(this.props.location.pathname, contentRouter)} projectId={this.props.match.params.id} />
|
<InterfaceMenu router={matchPath(this.props.location.pathname, contentRouter)} projectId={this.props.match.params.id} />
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user