@flatfile/vuejs

中文文档
3.0.1发布于 2022/08/05MITCommonJS近 30 天下载 2679

Vue.js flatfile adapter

原始使用文档
文档目录3 节
  1. Getting Started with Flatfile & Vue.js
  2. The 1 required property is
  3. Publishing

Flatfile Vue.js Component - @flatfile/vuejs

npm Minzipped Size NPM Downloads MIT License

NOTE: If you upgrading from previous versions (0.x), v3+ comes with some updates & breaking changes

BREAKING CHANGES:

Note that the latest version of @flatfile/vuejs 3+ uses the new @flatfile/sdk underneath which changes the API surface of interacting with the flatfile adapter entirely.

Read more about these changes here

There is now only 1 required input, and that is :token (which you must receive from your backend).

Read more about generating a Token here


Getting Started with Flatfile & Vue.js

We've made it really simple for you to get started with Flatfile with our new Flatfile Component. Here's what you'll need to know to get started.

First, install the dependency via npm:

npm install @flatfile/vuejs@3

This will give you access to the <flatfile-button /> component as well as the same basic functionality as our new SDK.

Simply add the import to a component where you want to include the Flatfile vuejs adapter via

import { FlatfileButton } from '@flatfile/vuejs';

export default {
  name: 'DemoComponent',
  components: {
    FlatfileButton,
  },
  // ...
}

Now in your application simply utilize this new <flatfile-button> component, but make sure to pass in the 1 required prop, (and/or any optional ones you may need for your application).

The 1 required property is

  • :token (String) [ which you need to get from your backend ]

Read more here on how to implement a secure token.

<flatfile-button :token="token">
  Upload to Flatfile!
</flatfile-button>

<script>
import { FlatfileButton } from '@flatfile/vuejs';

export default {
  name: 'App',
  components: {
    FlatfileButton,
  },
  data: () => ({
    token: 'Your_Token_You_Received_From_Your_Backend',    
  })
}
</script>

Here's an example passing down many of the other optional parameters/methods available to the adapter.

<flatfile-button 
  :token="token"
  :onInit="onInit"
  :onUpload="onUpload"
  :onLaunch="onLaunch"
  :onClose="onClose"
  :onComplete="onComplete"
  :onError="onError" 
  class="ff-button"
>
  Upload to Flatfile!
</flatfile-button>

<script>
import { FlatfileButton } from '@flatfile/vuejs';

export default {
  name: 'App',
  components: {
    FlatfileButton,
  },
  data: () => ({
    token: 'Your_Token_You_Received_From_Your_Backend',
  }),
  methods: {
    onInit: function (data) {
      console.log('onInit')
      console.log(data)
    },
    onUpload: function (data) {
      console.log('onUpload')
      console.log('data')
    },
    onLaunch: function (data) {
      console.log('onLaunch')
      console.log('data')
    },
    onClose: function (data) {
      console.log('onClose')
      console.log('data')
    },
    onComplete: function (data) {
      console.log('onComplete')
      console.log('data')
    },
    onError: function (error) {
      console.log('onError')
      console.log(error)
    },
  }
}
</script>

Additional options

You can also pass down mountUrl and apiUrl to the <flatfile-button>.

<flatfile-button 
  :token="token"
  :mountUrl="mountUrl"
  :apiUrl="apiUrl"
>
  Upload to Flatfile!
</flatfile-button>

<script>
import { FlatfileButton } from '@flatfile/vuejs';

export default {
  name: 'App',
  components: {
    FlatfileButton,
  },
  data: () => ({
    token: 'Your_Token_You_Received_From_Your_Backend',
    mountUrl: 'mountUrl',
    apiUrl: '',
  }),
  // ... everything else
}
</script>

Publishing

Update changelog (if needed), update package.json version (semver), add any updates needed for README (if needed), then run the following scripts:

npm run build:lib
npm publish

版本与发布记录

@flatfile/vuejs 共发布 14 个版本,首次发布于 2021/04/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.0.1latest2022/08/054 年前
3.0.02022/03/044 年前
0.3.62022/01/124 年前
0.3.52022/01/084 年前
0.3.42021/12/234 年前
0.3.32021/12/224 年前

关于 @flatfile/vuejs 的常见问题

@flatfile/vuejs 是什么?

Vue.js flatfile adapter

如何安装 @flatfile/vuejs?

在项目目录运行 npm install @flatfile/vuejs,或使用 pnpm add / yarn add / bun add。

@flatfile/vuejs 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/flatfile__vuejs 是否存在。

@flatfile/vuejs 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@flatfile/vuejs 可以商用吗?

@flatfile/vuejs 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@flatfile/vuejs 的下载量有多少?

根据 npm 官方下载统计,@flatfile/vuejs 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,679 次,日均约 89 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@flatfile/vuejs 还在维护吗?

最新版本 3.0.1 发布于 2022/08/05(4 年前);至今共发布 14 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/04/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。