vue-barcode: JsBarcode is not a function

Hi, I got an error of ‘JsBarcode is not a function’.

Here is my component:

<script setup lang="ts">
import VueBarcode from '@chenfengyuan/vue-barcode';
</script>

<template>
    <vue-barcode value="5901234123457" :options="{ format: 'EAN13' }"></vue-barcode>
</template>

Browser shows these error messages:

2022-08-14 08-59-32 的螢幕擷圖

And I installed JsBarcode for sure.

2022-08-14 09-11-16 的螢幕擷圖

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

This is still not working. I get the same error on Vue 3.

don’t works in vite TypeError: JsBarcode is not a function

I’m also facing the same error on Vue3.

How about registering the component as a global one? This works fine for me.

import { createApp } from 'vue';
import VueBarcode from '@chenfengyuan/vue-barcode';

const app = createApp({});

app.component(VueBarcode.name, VueBarcode);