本帖最后由 babycv 于 2018-4-12 14:27 编辑
我的项目采用dva-cli创建,添加了wijmo的npm依赖,运行页面就报如下错误
C:/Users/Admin/Desktop/NpmImages/wijmo-amd-min/wijmo.react.grid.js
Module not found: Can't resolve 'wijmo/wijmo.grid' in 'C:\Users\Admin\Desktop\NpmImages\wijmo-amd-min'
package.json中的依赖如下:
"dependencies": {
"antd": "^3.2.2",
"dva": "^2.1.0",
"dva-loading": "^1.0.4",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"wijmo": "file:///C:\\Users\\Admin\\Desktop\\NpmImages\\wijmo-amd-min"
}
JS文件内容如下:
import React from 'react';
import * as wjGrid from 'wijmo/wijmo.react.grid';
function WijmoGrid() {
this.data = [
{ country: 'Japan', date: new Date(2017, 1, 1), sales: 0 },
{ country: 'USA', date: new Date(2017, 1, 1), sales: 0 },
{ country: 'UK', date: new Date(2017, 1, 1), sales: 0 },
{ country: 'China', date: new Date(2017, 1, 1), sales: 0 }
];
return (
<wjGrid.FlexGrid
autoGenerateColumns={false}
columns={[
{ header: 'Country', binding: 'country', width: '*' },
{ header: 'Date', binding: 'date' },
{ header: 'Sales', binding: 'sales', format: 'c2' }
]}
itemsSource={this.data}
style={{ height: '250px', width: '500px' }}
/>
);
}
export default WijmoGrid;
|
|