小编Dyl*_*lan的帖子

“FetchPeriod”类型上不存在属性“state”

我正在尝试按照本教程学习 ReactJS: 教程

我是编程语言的新手,所以我现在不知道该怎么做。

当我尝试添加“Fetchemployee.tsx”文件时,该this.state方法出现错误。

(TS) 类型“FetchPeriod”上不存在属性“state”

这是代码:

import * as React from 'react';
import { RouteComponentProps } from 'react-router';
import { Link, NavLink } from 'react-router-dom';

interface FetchPeriodDataState {
    periodList: PeriodData[];
    loading: boolean;
}

export class FetchPeriod extends React.Component<RouteComponentProps<{}>, FetchPeriodDataState> {
    constructor(props) {
        super(props);
    this.state = { periodList: [], loading: true };


    fetch('api/Period/Index')
        .then(response => response.json() as Promise<PeriodData[]>)
        .then(data => {
            this.setState({ periodList: data, loading: false });
        });

    // This binding is necessary to make "this" work …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs react-router react-props

12
推荐指数
1
解决办法
1万
查看次数

Bootstrap列导致水平滚动条

在本网站的"我的工作"部分: 网站

有些东西导致它太宽.

当您将鼠标悬停在项目上(或触发:悬停状态<div class="projectbox">并查看项目图标(眼睛,github和图像)时,最后一个项目的"图像"是我认为的原因.

但是,我不知道为什么会这样.我应该从这些按钮中删除填充吗?我觉得那不是你应该做的.(如果填充甚至是导致它发生的原因).

相关代码:

相关代码

html css twitter-bootstrap twitter-bootstrap-3

1
推荐指数
1
解决办法
3968
查看次数