# qrcode.vue **Repository Path**: joejay/qrcode.vue ## Basic Information - **Project Name**: qrcode.vue - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-05-07 - **Last Updated**: 2021-05-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # qrcode.vue ⚠️ 如果你正在使用 Vue 3,请升级 `qrcode.vue` 到 `3.x`; 🔒 如果你正在使用 Vue 2,请保持 `qrcode.vue` 的版本为 `1.x`; 一款 Vue.js 二维码组件. [![Build Status](https://travis-ci.org/scopewu/qrcode.vue.svg?branch=master)](https://travis-ci.org/scopewu/qrcode.vue) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/scopewu/qrcode.vue/blob/master/LICENSE) ## 快速开始 快速添加 `qrcode.vue` 组件到项目中 ```bash npm install --save qrcode.vue # yarn add qrcode.vue ``` ``` dist/ |--- qrcode.vue.cjs.js // CommonJS |--- qrcode.vue.esm.js // ES module |--- qrcode.vue.browser.js // UMD for browser or require.js or CommonJS |--- qrcode.vue.browser.min.js // UMD Minimum size ``` ## 使用 e.g. ```javascript import { createApp } from 'vue' import QrcodeVue from 'qrcode.vue' createApp({ data: { value: 'https://example.com', }, template: '', components: { QrcodeVue, }, }).mount('#root') ``` 或者,在独有单文件扩展 `*.vue` 中使用: ```html ``` ## Component props ### value - Type: `string` - Default: `''` 二维码的内容值。 ### level - Type: `string` - Default: `H` 二维码的容错能力等级,取值为 'L', 'M', 'Q', 'H' 之一。了解更多,[维基百科:QR_code](https://en.wikipedia.org/wiki/QR_code#Error_correction)。 ### size - Type: `number` - Default: `100` 二维码大小。 ### margin - Type: `number` - Default: `0` 定义空白区的宽度应该是多少。 ### renderAs - Type: `string` - Default: `canvas` 生成二维码的 HTML 标签,可选 `canvas` 或 `svg`。 ### background - Type: `string` - Default: `#ffffff` 二维码背景颜色。 ### foreground - Type: `string` - Default: `#000000` 二维码前景颜色。 ### class - Type: `string` - Default: `''` 传递给二维码根元素的类名。 ## 软件许可 copyright © 2021 scopewu, license by [MIT](https://github.com/scopewu/qrcode.vue/blob/master/LICENSE)