我以前是通过自制软件安装pyenv来管理python版本的,但是现在我想使用anaconda。但是我不知道如何卸载pyenv,请告诉我。
我可以在 this.props 上安慰我的财产。但是 ts 显示错误 ts(2339)。
我试图定义 this.props 的类型。但是 'this.props' 已经是只读的。
import React from 'react';
import {Avatar} from 'antd';
import router from 'umi/router';
import styles from './index.css';
import { connect } from 'dva';
import LeftBar from '../leftbar';
const mapStateToProps = (state: any) => {
return {
username: state.global.username,
login: state.global.login
}
}
class Header extends React.Component {
componentWillMount(){
if(!this.props.login){
router.push('/');
}
}
handleClick = () => {
console.log('this state:'+this.state);
console.log('this props:'+this.props);
// router.push('/');
}
public render () {
return ( …Run Code Online (Sandbox Code Playgroud) 我可以正确运行此代码。但是,当我将代码提交到 git 时,它会显示“错误:src/layouts/index.tsx:25:9 - 没有子项的 JSX 元素必须自关闭”。
我试图添加 React.Fragment 标签。但它不起作用。我也删除了第 25 行。但同样的错误显示。仍然是“index.tsx:25:9”。我也尝试过使用自动关闭。但我必须将值放入 Menu.Item 中。
这是我的代码:
import * as React from 'React';
import {Menu, Icon} from 'antd';
import './test.less';
import styles from './index.css';
const SubMenu = Menu.SubMenu;
class LeftBar extends React.Component{
constructor(props: any) {
super(props);
}
hideLeftBar = () => {
// console.log(styles);
}
public render() {
return (
<div className={styles.leftbar}>
<Menu
className={styles.menu}
mode="inline"
// openKeys={this.state.openKeys}
// onOpenChange={this.onOpenChange}
style={{ width: 250 }}
>
<SubMenu className="test" key="sub1" title={<span><Icon type="mail" /><span>Navigation One</span></span>}>
<Menu.Item …Run Code Online (Sandbox Code Playgroud)