FlatFilers / vuejs-adapter

VueJS
MIT License
3 stars 3 forks source link

VueJs 3 with Composition Api Error #30

Open AtahanAltiparmak opened 1 year ago

AtahanAltiparmak commented 1 year ago

Hi,

When I use FlatfileButton in my Vue3 project, the error occurred like below, and the page not rendered as well.

Screen Shot 2023-06-19 at 16 36 02

You wrote usages of Options api. Is @flatfile/vuejs package not applicable for Vue3 with CompositionApi? @MarkPieszak

viracoding commented 1 year ago

As I see the package is written in Vue2. So actually you have to use the options-api. Probably you even have to install @vue/compat for Vue3 compatibility.

marcusball commented 1 year ago

If you trust me, you can use my fork which supports Vue 3 at @marcusball/flatfile-button-vue, or clone it yourself.

The main note for that is that is I updated it to use events instead of props, so the syntax for the button would be:

<flatfile-button 
    :token="flatfileToken"
    @init="onFlatfileInit"
    @launch="onFlatfileLaunch"
    @complete="onFlatfileComplete"
    @error="onFlatfileError" 
    @close="onFlatfileClose"
>
    Upload to Flatfile!
</flatfile-button>
async function onFlatfileComplete(payload) {
    const data = await payload.data();
    console.log('Flatfile upload complete', data);
}