qrcode-vue3 icon indicating copy to clipboard operation
qrcode-vue3 copied to clipboard

This package preventing hot reloading on my Nuxt 3 app

Open keanallen opened this issue 1 year ago • 8 comments

When I started to use this plugin, I noticed that my nuxt 3 app does not reflect the code changes on the UI. But when I removed thids plugin, everything's back to normal.

keanallen avatar Aug 29 '23 13:08 keanallen

Same here. Not using Nuxt just plain Vue3. As long as a QRCodeVue3 component is loaded anywhere the app stopped hot reloading.

thlintw avatar Sep 06 '23 05:09 thlintw

@thlintw you can use this QRCodeVue

keanallen avatar Sep 06 '23 09:09 keanallen

Same here. Not using Nuxt just plain Vue3. As long as a QRCodeVue3 component is loaded anywhere the app stopped hot reloading.

Same here.

boobo94 avatar Dec 01 '23 15:12 boobo94

Same for me with Quasar v2

SymphonyCR avatar Dec 10 '23 18:12 SymphonyCR

Same here with Quasar v2

JulianGarcia04 avatar Dec 13 '23 21:12 JulianGarcia04

Just to confirm this blocks hot reload on Quasar v2.

dmonterde avatar Jan 08 '24 13:01 dmonterde

My last solution was using https://www.npmjs.com/package/styled-qr-code with vue3. Example below.

Component:

<template>
  <div class="text-center">
    <div class="qrcode_container" ref="qrCodeRef"></div>

    <button @click="download">Download</button>
  </div>
</template>

<script lang="ts" setup>
import QRCodeStyling, { Options } from 'styled-qr-code';
import { watch } from 'vue';
import { onMounted, ref } from 'vue';

const qrCodeRef: any = ref(null);

const props = defineProps({
  data: String,
});


const options: Options = {
  width: 500,
  height: 500,
  type: 'svg',
  data: props.data,
  image: 'logo.png',
  margin: 10,
  qrOptions: {
    typeNumber: 0,
    mode: 'Byte',
    errorCorrectionLevel: 'H',
  },
  imageOptions: {
    hideBackgroundDots: true,
    imageSize: 0.2,
    margin: 0,
    crossOrigin: 'anonymous',
  },
  dotsOptions: {
    color: '#4a4bc6',

    type: 'rounded',
  },
  backgroundOptions: {
    color: '#ffffff',
  },
  cornersSquareOptions: {
    color: '#000000',
    type: 'square',
  },
  cornersDotOptions: {
    color: '#000000',
    type: 'dot',
  },
};

const qrCode = new QRCodeStyling(options);

onMounted(async () => {
  qrCode.append(qrCodeRef.value);
});

watch(
  () => props.data,
  (newValue) => {
    qrCode.update({ ...options, data: newValue });
  }
);

function download() {
  qrCode.download({
    name: `qrcode-${props.data}`,
    extension: 'png',
  });
}
</script>

<style scoped lang="scss">
.qrcode_container {
  text-align: center;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
</style>

boobo94 avatar Jan 08 '24 14:01 boobo94

Yeah, very sad. Spent some time implementing this module, but it breaks hot reloading for the whole project on VUE3

dedfft avatar Sep 12 '24 11:09 dedfft