Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 调整反应表的大小_Javascript_Html_Reactjs_React Table - Fatal编程技术网

Javascript 调整反应表的大小

Javascript 调整反应表的大小,javascript,html,reactjs,react-table,Javascript,Html,Reactjs,React Table,我正试图建立一个网页与反应表,我不知道如何调整表,使它不会占用整个页面。这是需要在CSS中完成的还是可以在React中呈现?我正在使用CreateReact应用程序。谢谢你的帮助。以下是我的App.js和App.css文件: App.js: class App extends Component { constructor(props) { super(props); this.state = {value: ''}; this.handleChange = thi

我正试图建立一个网页与反应表,我不知道如何调整表,使它不会占用整个页面。这是需要在CSS中完成的还是可以在React中呈现?我正在使用CreateReact应用程序。谢谢你的帮助。以下是我的App.js和App.css文件:

App.js:

class App extends Component {
  constructor(props) {
    super(props);
    this.state = {value: ''};

    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(event) {
    this.setState({value: event.target.value});
  }

  handleSubmit(event) {
    alert('A name was submitted: ' + this.state.value);
    event.preventDefault();
  }

  render() {

  const data = [{
    name: 'Tanner Linsley',
    age: 26,
    friend: {
      name: 'Jason Maurer',
      age: 23,
    }
  }]

  const columns = [{
    Header: 'Username/Email',
    accessor: 'name' // String-based value accessors!
  }, {
    Header: 'Risk Score',
    accessor: 'age',
    Cell: props => <span className='number'>{props.value}</span> // Custom cell components!
  }, 

  {
    id: 'friendName', // Required because our accessor is not a string
    Header: 'Location',
    accessor: d => d.friend.name // Custom value accessors!
  }]

  return <ReactTable
    data={data}
    columns={columns}
  />
  }
}

export default App;

React表使用flex值1。如果要调整表的大小,需要覆盖默认类或能够为props赋值。请仔细阅读这些文件以了解更多信息

例如,如果您重写类

.ReactTable.-striped.-highlight {
    width: 532px;
}

请谨慎,并根据需要进行修改。

反应表使用弹性值1。如果要调整表的大小,需要覆盖默认类或能够为props赋值。请仔细阅读这些文件以了解更多信息

例如,如果您重写类

.ReactTable.-striped.-highlight {
    width: 532px;
}
请谨慎,并根据您的需要进行修改