草庐IT

excel-import

全部标签

javascript - Jest 中的动态导入产生 : SyntaxError: Unexpected token import

还不知道如何解决这些错误,Jest提示像这样的动态导入:constimportModules=Promise.all([import('containers/HomePage/reducer'),import('containers/HomePage/sagas'),import('containers/HomePage'),]);错误信息:F:\react-boilerplate\app\store.js:49import('./reducers').then(function(reducerModule){^^^^^^SyntaxError:Unexpectedtokenimpor

javascript - TS1148 ~ 如何使用 --module : "import" and typescript 2. x "none"

我目前正在使用一些旧版JavaScript开发一个项目。该应用程序不包含模块加载器,它只是将所有内容作为全局变量放入window对象中。遗憾的是,接触遗留代码并包含模块加载器对我来说不是一个可行的选择。我想在我自己的代码中使用typescript。我设置了typescript编译器选项module:"none"在我的tsconfig.json中,我只使用命名空间来组织我自己的代码。到目前为止效果很好。..到现在为止:import*asRxfrom'rxjs';..Rx.Observable.from(['foo',bar']);...//ResultsinTypeScript-Erro

javascript - import {module} 和 import module 的区别

这个问题在这里已经有了答案:`exportconst`vs.`exportdefault`inES6(6个答案)usingbracketswithjavascriptimportsyntax(2个答案)WhenshouldIusecurlybracesforES6import?(11个答案)关闭5年前。我看到了以下两种从ES6中的另一个模块导入代码的变体:import{module}from"./Module"和importmodulefrom"./Module"其中module是文件中定义的ES6类Module.js这两个导入语句有什么区别?

javascript - 使用javascript将工作表添加到excel文件

假设我有3张table。我想将3个工作表(每页一个表)中的表插入到一个excel文件中(不需要ActiveXObject)我试过下面的代码,但它只创建了一个工作表vartableToExcel=(function(){varuri='data:application/vnd.ms-excel;base64,',template='{worksheet}{table}{table}',base64=function(s){returnwindow.btoa(unescape(encodeURIComponent(s)))},format=function(s,c){returns.rep

javascript - 如何在 AngularJS 中将 JSON 导出或转换为 Excel?

我正在从我的Angular项目中的剑道图表数据源中提取一个包含4个对象的数组,每个对象内部都有一个数组。每个子对象中的数据大小不一,但始终包含一个时间戳和1-5个值字段。我需要将此数组导出到Excel文件(.xls或.xlsx而非CSV)。到目前为止,我设法将JSON作为一个文件单独下载(.json和未格式化的.xls)。我希望每个对象都是一本书,并且在那本书中有一个格式,在第一列中有时间戳,在另一列中有值1,依此类推。列的标题应该是时间戳、value1名称等(我正在根据用户偏好在ui上翻译这些)。如何使用Angular构建这种类型的格式化.xls文件?我不知道有什么特别好的库,但很清

javascript - webpack.config.babel.js中使用 'import'报错

(function(exports,require,module,__filename,__dirname){importpathfrom'path'^^^^^^SyntaxError:Unexpectedtokenimport当我使用webpack-dev-server--hot时出现此错误。出现这种情况好像是因为它无法读取import或者webpack不支持import。我尝试使用babel-register但它不起作用。有什么办法可以解决这个问题吗?请引用下面的代码。webpack.config.babel.jsimportpathfrom'path'importwebpackf

javascript - Babel ES6 导入错误,SyntaxError : Unexpected token import

我正在尝试设置一个基本的模块化程序,但我似乎遇到了导入模块的问题。我尝试导入我的自定义模块,但出现以下错误:(function(exports,require,module,__filename,__dirname){importtestStepfrom'testStep';^^^^^^SyntaxError:Unexpectedtokenimport导致问题的代码:测试用例.jsimporttestStepfrom'testStep';testStep.hello();测试步骤.jsvartestStep={hello:hello,};varhello=()=>{console.lo

javascript - 用于 excel 导入的 javascript 生成的 csv 中的换行符

我在浏览器端(chrome窗口)使用javascript从网页生成并下载CSVfunctiontoCsv(arr){returnarr.reduce(function(csvString,row){csvString+=row.join(',');csvString+="\r\n";//";";//"\n";returncsvString;},'');}functionflowDataCsv(){document.location='data:Application/octet-stream,'+toCsv(flowDataGrid);}我曾尝试使用“;”、“\r\n”和“\n”分隔行

javascript - "sequelize.import()"如何从另一个文件导入模型?

当我按以下方式创建新模型时://user.jsfilemodule.exports=function(sequelize,DateTypes){returnsequelize.define("user",{email:{type:DateTypes.STRING,allowNull:false,unique:true,validate:{isEmail:true}},password:{type:DateTypes.STRING,allowNull:false,validate:{len:[7,100]}}});};然后进入我构建新数据库的db.js文件:varSequelize=re

javascript - “等于”未定义 : Ember-qunit does not seem to be importing

Qunit测试方法似乎不可用,尽管我很确定我正在正确导入它们。我收到以下错误:unit/models/friend-test.js:line11,col3,'ok'isnotdefined.unit/models/friend-test.js:line17,col3,'equal'isnotdefined.unit/models/friend-test.js:line23,col3,'equal'isnotdefined.unit/models/friend-test.js:line31,col3,'equal'isnotdefined.unit/models/friend-test.