New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@netjoy/ex2json

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netjoy/ex2json

基于 js 编写的轻量级辅助库,将 .xlsx | .xls | .csv 文件内的数据转成 json 数据,方便数据处理,表单数据上传服务器。

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

一、使用

  • 安装

    $ npm i @netjoy/ex2json
    
  • 引入

    import ex2json from "@netjoy/ex2json";
    
  • 使用

    <template>
      <input type="file" @change="read" />
    </template>
    
    <script>
      import ex2json from "ex2json";
      export default {
        methods: {
          read(e) {
            // 文件对象
            const file = e.target.files[0];
            // 转成成 json
            ex2json.parse(file, (code, res) => {
              console.log(code, res);
            });
          },
        },
      };
    </script>
    
  • 可能会遇到的问题:

    • Vue3 报错 Module not found: Error: Can't resolve 'fs' in 'xxx',可在 vue.config.js 中新增以下配置即可:

      const { defineConfig } = require('@vue/cli-service')
      module.exports = defineConfig({
        transpileDependencies: ...,
        devServer: { ... },
        // 下面这段配置添加上即可
        configureWebpack: {
          resolve: { fallback: { fs: false } }
        }
      })
      

Keywords

excel2json

FAQs

Package last updated on 01 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts