GithubHelp home page GithubHelp logo

fengyuanchen / vue-qrcode Goto Github PK

View Code? Open in Web Editor NEW
1.0K 16.0 138.0 1.56 MB

QR code component for Vue.js

Home Page: https://fengyuanchen.github.io/vue-qrcode/

License: MIT License

JavaScript 42.90% TypeScript 55.98% Shell 1.12%
qrcode qr-code vue-qrcode vue vuejs vue-component

vue-qrcode's Introduction

vue-qrcode

Coverage Status Downloads Version Gzip Size

QR code component for Vue 3, bases on node-qrcode. For Vue 2, check out the v1 branch.

Main npm package files

dist/
├── vue-qrcode.js         (UMD, default)
├── vue-qrcode.min.js     (UMD, compressed)
├── vue-qrcode.esm.js     (ECMAScript Module)
├── vue-qrcode.esm.min.js (ECMAScript Module, compressed)
└── vue-qrcode.d.ts       (TypeScript Declaration File)

Getting started

Installation

Using npm:

npm install vue@3 qrcode@1 @chenfengyuan/vue-qrcode@2

Using pnpm:

pnpm add vue@3 qrcode@1 @chenfengyuan/vue-qrcode@2

Using Yarn:

yarn add vue@3 qrcode@1 @chenfengyuan/vue-qrcode@2

Using CDN:

<script src="https://unpkg.com/vue@3"></script><!-- Vue.js is required -->
<script src="https://unpkg.com/[email protected]/build/qrcode.js"></script><!-- qrocde is required -->
<script src="https://unpkg.com/@chenfengyuan/vue-qrcode@2"></script>

Usage

import { createApp } from 'vue';
import VueQrcode from '@chenfengyuan/vue-qrcode';

const app = createApp({});

app.component(VueQrcode.name, VueQrcode);
<vue-qrcode value="Hello, World!" :options="{ width: 200 }"></vue-qrcode>

Browser support

Same as Vue 3.

Versioning

Maintained under the Semantic Versioning guidelines.

License

MIT © Chen Fengyuan

vue-qrcode's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-qrcode's Issues

Accessing img src of resulting qr code

I'd love an example of accessing the component's internal state.
More precisely, the src/base64 string of the image it creates when tag equals img.

Use case: I'm wrapping the component in a div which contains a v-on:click event.
On click I want to save the img to a file.

I could, of course, simply give an id to the component and target that. However, that doesn't appear to be a very vue-ish way of doing this.

Qrcode with text

I'm generating qr code to links, and it's ok. I wanna know if is possible put a text inside or below the qr code with a small phrase, or a word.

Eye Pattern Of QR Code

请问能不能 加个 修改 眼睛形状 的 调整?
比如原本的 正方形 可以变成 圆形

Screenshot 2019-07-02 at 4 33 00 PM

Screenshot 2019-07-02 at 5 03 05 PM

非常谢谢

引用库的时候报了两个错

报错信息如下:
warning in ./node_modules/@chenfengyuan/vue-qrcode/dist/vue-qrcode.esm.js
"export 'defineComponent' was not found in 'vue'

warning in ./node_modules/@chenfengyuan/vue-qrcode/dist/vue-qrcode.esm.js
"export 'h' was not found in 'vue'

请问作者这个怎么回事,现在项目都打不开了,一直报这两个错

jest cannot set property '0' of undefined

TypeError: Cannot set property '0' of undefined
at Object.qrToImageData (/node_modules/_@[email protected]@@chenfengyuan/vue-qrcode/dist/vue-qrcode.common.js:2679:25)

在使用Jest做单元测试时,采用了jest-canvas-mock来模拟canvas,结果在vue-qrcode.common.js的2679行代码报错,打印出来的imgData为undefined,所以代码报错。

Error

image
image

报错(error):
You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

rendering with enable-force-dark and svg tag

Hi,
i have this:
<VueQrcode class="mx-auto z-30 relative" style="width:230px; height:230px;" :value=qrcode tag="svg" :options="{ width: 230, color: {dark: '#000',light: '#fff'} }"></VueQrcode>
with flag enable-force-dark enabled i obtain a white square.
Possible solution?

CI build failed.

I am using 2.0.0-rc.1 version.
I got an error when building with CI.

This dependency was not found:
 ERROR  Build failed with errors.

* qrcode in ./node_modules/@chenfengyuan/vue-qrcode/dist/vue-qrcode.esm.js

Is it possible to move the qrcode from devDependencies to dependencies?

[Vue warn]: Failed to resolve component: vue-qrcode

Hi!... i have tried to import it just as stated in the documentation, but... I'm getting this error:

[Vue warn]: Failed to resolve component: vue-qrcode

main.ts

...
import { createApp } from 'vue'
import VueQrcode from "@chenfengyuan/vue-qrcode";
...
let app = createApp(App).provide('store', store)
...
app.component(VueQrcode.name, VueQrcode);

Any hints? I'm using script setup for components, but still, I have imported other components before and they work perfectly...

Thanks in advance

vue 报错

"@chenfengyuan/vue-qrcode": "^1.0.2"

vue版本:

"vue": "^2.4.2"

prevUrl: ''

报错:

Error in callback for watcher "$props": "Error: No input text"

if (typeof data === 'undefined' || data === '') {
	    throw new Error('No input text')
	  }

提一个组件问题

new QRious(Object.assign({
        element: this.$el,
        value: this.value,
      }, this.options));

为什么要用Object.assign

Vue 3, extract QR image

Is there an example somewhere on how to extract the QR image from QR generated in template ( perhaps using ref or other means )
I am trying to use the generated QR to insert into email. Thanks!

Send component to print as canvas

Hello!
I'm trying to send my component to print, but what I've searched is that I need to convert it to v-html so I think converting the QR to canvas it would work.
Can anyone help me please?

qrcode :value="value" :options="{size: 200, foreground: 'black'}" v-html="QRcodigo"

that's my code.

Treat qrcode as dependency rather than peerDependency

In version 1.x, qrcode is dependency, but it changed now, it is peerDependency now. I'm really puzzled about what makes this change.
In my opinion, users don't need to install qrcode manually if qrcode is treated as dependency.

Eye Pattern Of QR

请问能不能 加个 修改 眼睛形状 的 调整?
比如原本的 正方形 可以变成 圆形

Screenshot 2019-07-02 at 4 33 00 PM

Screenshot 2019-07-02 at 5 03 05 PM

非常谢谢

Size issue with vuex

Hi,

When using this component with Vuex and a custom size, the new QRCode size does not respects the asked size when the QRCode value is updated (we get a small QRCode in a large, white square).

中文乱码

value字段的值传中文生成的二维码,扫描出来是乱码的,请问如何解决?

Hello how to download qr code after generated ?

Here is my code i want to download Qrcode.

<vue-qrcode :value="gameUrl.ios" class="sm:max-h-fit w-full  rounded-t-lg" tag="img" :options="{
 errorCorrectionLevel: 'Q',
 width:300
  }"></vue-qrcode>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.