You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importRNFSfrom'react-native-fs'importXLSXfrom'xlsx'//将数据格式化成XLSXletexportsData=[["id","name","value"],[1,"sheetjs",7262],[2,"js-xlsx",6969]]letrnfsPath=Platform.OS==='ios'
? RNFS.LibraryDirectoryPath
: RNFS.ExternalDirectoryPathletpath=''try{// 打包时要修改路径path=updateTool.getSdPath()+'/voerkabeeHistoryMessages.xlsx'// 测试路径// path = '/mnt/shared/geny_share/voerkabeeHistoryMessages.xlsx'}catch(e){logger.error('get local info path fail '+e)}constworkBook=XLSX.utils.book_new()constworkSheet=XLSX.utils.aoa_to_sheet(exportsData)XLSX.utils.book_append_sheet(workBook,workSheet,"SheetJS");constwbout=XLSX.write(workBook,{type: 'buffer',bookType: "xlsx"});// 写文件至pathRNFS.writeFile(path,wbout,'ascii').then(success=>{logger.debug('save data to local success')_this.setState({isLoading: false,downLoadVisible: true,downLoadInfo: _('导出成功')})}).catch(err=>{logger.error('save data to local fail '+err)_this.setState({isLoading: false,downLoadVisible: true,downLoadInfo: _('导出失败')})})}
The text was updated successfully, but these errors were encountered:
Algorithm 移动零
将为零的值移动到数组末尾,反之就是将非零的值移动到数组前面
为了减少移动次数,从数组的头部开始遍历,并使用变量nozeroIndex 记录非零值的下标,每遇到非零就按顺序填充数组,最后补0
执行用时:84 ms
Review vuejs的最佳实践
https://blog.usejournal.com/vue-js-best-practices-c5da8d7af48d
复述:
本文列出了14个点,描述了vuejs开发中需要注意的细节,包括变量命名规则,组件命名规则,事件必须又返回等,还列出了这些实践对应的好处。如:使用$ on监听事件时,记住使用destroy()上的$ off删除该监听器。 这可以防止发生内存泄漏。
Tip 使用git合并分支
例子:将main分支合并到branch
1.首先切换到branch分支上
2.git checkout branch // 确认本地与分支branch一致
3.git merge main // 将main分支合并过来
4.这个时候按情况解决冲突
5.git status //查看当前状态
6.git commit -m '提交的备注信息' // 提交代码
1.在项目目录下点击右键->切换->【选择分支branch】
2.拉取代码
3.点击右键->合并->【选择分支main】
4.解决冲突
5.提交代码
6.推送
Share 使用SheetJS+react-native-fs实现数据导出成excel文件
https://github.com/SheetJS/sheetjs/tree/7e932aec0080256b15a824a71e65a6755a9d386c/demos/react
实践:
The text was updated successfully, but these errors were encountered: