diff --git a/CHANGELOG.md b/CHANGELOG.md index a6e68e7..c677806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [3.4.1] - 2023-08-05 + +### BUGFIX + +- Fixed TypeScript type export error. + ## [3.4.0] - 2023-04-15 ### Performance diff --git a/README-zh_cn.md b/README-zh_cn.md index 90999ec..9658f18 100644 --- a/README-zh_cn.md +++ b/README-zh_cn.md @@ -67,6 +67,22 @@ createApp({ ``` +在 Vue 3 中配合 `TypeScript` 使用: + +```html + + + + ## Component props ### `value` diff --git a/README.md b/README.md index 6449e4b..f445c3c 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,22 @@ Or single-file components with a `*.vue` extension: ``` +When you use the component with Vue 3 with `TypeScript`: + +```html + + +``` + ## Component props ### `value` diff --git a/package.json b/package.json index 3afc6ed..2b286d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qrcode.vue", - "version": "3.4.0", + "version": "3.4.1", "description": "A Vue.js component to generate QRCode.", "type": "module", "main": "./dist/qrcode.vue.cjs.js", diff --git a/src/index.ts b/src/index.ts index 9da900f..5b2b755 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,8 @@ import { defineComponent, h, onMounted, onUpdated, PropType, ref } from 'vue' import QR from './qrcodegen' type Modules = ReturnType -type Level = 'L' | 'M' | 'Q' | 'H' +export type Level = 'L' | 'M' | 'Q' | 'H' +export type RenderAs = 'canvas' | 'svg' const defaultErrorCorrectLevel = 'H' @@ -104,7 +105,7 @@ const QRCodeProps = { const QRCodeVueProps = { ...QRCodeProps, renderAs: { - type: String as PropType<'canvas' | 'svg'>, + type: String as PropType, required: false, default: 'canvas', validator: (as: any) => ['canvas', 'svg'].indexOf(as) > -1,