我正在尝试使示例代码正常工作,但得到了一个错误
代码
import React, {Component} from "react";
import FixedDataTable from "fixed-data-table";
import {Table, Column, Cell} from 'fixed-data-table';
import './fixed-data-table.css';
var rows = [
['a1', 'b1', 'c1'],
['a2', 'b2', 'c2'],
['a3', 'b3', 'c3']
// .... and more
];
class App extends Component {
constructor(props) {
super(props);
this.rowGetter = this.rowGetter.bind(this);
}
rowGetter(rowIndex) {
return rows[rowIndex];
}
render() {
return (
<Table
rowHeight={50}
rowGetter={this.rowGetter}
rowsCount={rows.length}
width={5000}
height={5000}
headerHeight={50}>
<Column
label="Col 1"
width={3000}
dataKey={0}
/>
<Column
label="Col 2"
width={2000}
dataKey={1}
/>
</Table>
);
}
}
export default App;错误
Unexpected token (23:0)
21 | */
22 |
> 23 | .fixedDataTableCellGroupLayout_cellGroup {
| ^
24 | -webkit-backface-visibility: hidden;
25 | backface-visibility: hidden;
26 | left: 0;FixedDataTable https://facebook.github.io/fixed-data-table/
我正在使用https://github.com/vasanthk/react-universal-starter作为种子项目。
我试过按照https://github.com/christianalfoni/react-webpack-cookbook/wiki/Loading-CSS安装css加载器,但没有成功。
发布于 2015-11-12 10:55:07
别这么做:import './fixed-data-table.css';
您需要在<head>中导入css --使用<link rel="stylesheet" type="text/css" href="fixed-data-table.css">导入html。
https://stackoverflow.com/questions/33669739
复制相似问题