Javascript 模块分析失败:无效数字
我想用canvasJs库制作一个Renko图表,就像这样。但当我添加这些代码时Javascript 模块分析失败:无效数字,javascript,angular,typescript,Javascript,Angular,Typescript,我想用canvasJs库制作一个Renko图表,就像这样。但当我添加这些代码时 data:[Object] = [{ dataPoints: [ {x: new Date(2012,10,10),y:[5198, 5629, 5159, 5385]}, {x: new Date(2012,20,10),y:[5366, 5499, 5135, 5295]}, {x: new Date(2012,30,10),y:[5296, 5378, 5154,
data:[Object] = [{
dataPoints: [
{x: new Date(2012,10,10),y:[5198, 5629, 5159, 5385]},
{x: new Date(2012,20,10),y:[5366, 5499, 5135, 5295]},
{x: new Date(2012,30,10),y:[5296, 5378, 5154, 5248]},
{x: new Date(2012,40,10),y:[5254, 5279, 4788, 5124]},
{x: new Date(2012,50,10),y:[4910, 5286, 4770, 5278]},
{x: new Date(2012,60,10),y:[5283, 5348, 5032, 5229]},
{x: new Date(2012,70,10),y:[5220, 5448, 5164, 5258]},
{x: new Date(2012,08,10),y:[5276, 5735, 5215, 5703]},
{x: new Date(2012,09,10),y:[5704, 5815, 4888, 5619]},
{x: new Date(2012,10,10),y:[5609, 5885, 5548, 5879]},
{x: new Date(2012,11,10),y:[5878, 5965, 5823, 5905]},
{x: new Date(2013,10,10),y:[5937, 6111, 5935, 6034]},
{x: new Date(2013,10,10),y:[6040, 6052, 5671, 5693]},
{x: new Date(2013,20,10),y:[5702, 5971, 5604, 5682]},
{x: new Date(2013,30,10),y:[5697, 5962, 5477, 5930]},
{x: new Date(2013,40,10),y:[5911, 6229, 5910, 5985]},
{x: new Date(2013,50,10),y:[5997, 6011, 5566, 5842]},
{x: new Date(2013,60,10),y:[5834, 6093, 5675, 5742]},
{x: new Date(2013,70,10),y:[5776, 5808, 5118, 5471]},
{x: new Date(2013,08,10),y:[5480, 6142, 5318, 5735]},
{x: new Date(2013,09,10),y:[5756, 6309, 5700, 6299]},
{x: new Date(2013,10,10),y:[6289, 6342, 5972, 6176]},
{x: new Date(2013,11,10),y:[6171, 6415, 6129, 6304]}
]
}];
我收到“模块解析失败:无效数字”错误:
Error: ./src/app/pages/stockdetails/stockdetails.component.ts 24:40
Module parse failed: Invalid number (24:40)
File was processed with these loaders:
* ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
* ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| { x: new Date(2012, 60, 10), y: [5283, 5348, 5032, 5229] },
| { x: new Date(2012, 70, 10), y: [5220, 5448, 5164, 5258] },
> { x: new Date(2012, 08, 10), y: [5276, 5735, 5215, 5703] },
| { x: new Date(2012, 09, 10), y: [5704, 5815, 4888, 5619] },
| { x: new Date(2012, 10, 10), y: [5609, 5885, 5548, 5879] },
这是我的tsconfig.json文件
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"module": "es2020",
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false
}
}
我尝试了许多其他问题的答案,但都不管用。
我的角度版本是11.2.6,节点版本是14.16.0不能使用像“08”和“09”这样的值 您必须更换新日期(2012,08,10) 新日期(2012年8月10日)
只需在之前删除0。您不能使用像“08”和“09”这样的值 您必须更换新日期(2012,08,10) 新日期(2012年8月10日)
只需在前面删除0。JavaScript引擎将前导零解释为-如果它们有效,否则将被视为十进制数。您可以删除前导零
新日期(2012,8,10)
或以ISO格式传递日期新日期(“2012-08-10”)
。查看此页面以了解更多信息。JavaScript引擎将前导零解释为-如果它们有效,否则将被视为十进制数。您可以删除前导零新日期(2012,8,10)
或以ISO格式传递日期新日期(“2012-08-10”)
。签出此以获取更多信息