1
1
# qrcode.vue
2
2
3
- ⚠️ 現在、Vue 3.xを使用している場合は、` qrcode.vue ` を` 3.x ` にアップグレードしてください。
3
+ ⚠️ 現在、Vue 3.xを使用している場合は、` qrcode.vue ` を` 3.x ` にアップグレードしてください。
4
4
5
- 🔒 Vue 2.xを使用している場合は、バージョン` 1.x ` を使用し続けてください。
5
+ 🔒 Vue 2.xを使用している場合は、バージョン ` 1.x ` を使用し続けてください。
6
6
7
- [ QRコード] ( https://en.wikipedia.org/wiki/QR_code ) を生成するためのVue.jsコンポーネントです 。Vue 2とVue 3の両方をサポートしています 。
7
+ [ QRコード] ( https://en.wikipedia.org/wiki/QR_code ) を生成するための Vue.js コンポーネントです 。Vue 2 と Vue 3 の両方をサポートしています 。
8
8
9
- [ ![ GitHub license] ( https://img.shields.io/badge/license-MIT-blue.svg )] ( https://github.com/scopewu/qrcode.vue/blob/master /LICENSE )
9
+ [ ![ GitHub license] ( https://img.shields.io/badge/license-MIT-blue.svg )] ( https://github.com/scopewu/qrcode.vue/blob/main /LICENSE )
10
10
11
11
[ English] ( ./README.md )
12
12
13
13
## インストール
14
14
15
- ` qrcode.vue ` コンポーネントをVue.jsアプリに使用できます 。
15
+ ` qrcode.vue ` コンポーネントを Vue.js アプリに使用できます 。
16
16
17
17
``` bash
18
18
npm install --save qrcode.vue # yarn add qrcode.vue
@@ -45,7 +45,7 @@ createApp({
45
45
}).mount (' #root' )
46
46
```
47
47
48
- - または、` *.vue ` 拡張子の単一ファイルコンポーネントで使用します:
48
+ または、` *.vue ` 拡張子の単一ファイルコンポーネントで使用します:
49
49
50
50
``` html
51
51
<template >
@@ -68,46 +68,7 @@ createApp({
68
68
</script >
69
69
```
70
70
71
- - グラデーションの使用例
72
-
73
- > グラデーションをサポートする ` QrcodeVue ` コンポーネントを使用するには、グラデーション関連のプロパティを渡すことができます:
74
-
75
- ``` html
76
- <template >
77
- <qrcode-vue
78
- :size =" size"
79
- :value =" fullUrl"
80
- :level =" level"
81
- :margin =" margin"
82
- :render-as =" renderAs"
83
- :background =" background"
84
- :gradient =" true"
85
- :gradient-type =" gradientType"
86
- :gradient-start-color =" gradientStartColor"
87
- :gradient-end-color =" gradientEndColor"
88
- />
89
- </template >
90
-
91
- <script >
92
- export default {
93
- data () {
94
- return {
95
- size: 200 ,
96
- fullUrl: ' https://example.com' ,
97
- level: ' H' ,
98
- margin: 4 ,
99
- renderAs: ' svg' , // or 'canvas'
100
- background: ' #ffffff' ,
101
- gradient: true ,
102
- gradientType: ' linear' , // or 'radial'
103
- gradientStartColor: ' #ff0000' , // グラデーションの開始色
104
- gradientEndColor: ' #0000ff' , // グラデーションの終了色
105
- }
106
- },
107
- }
108
- </script >
109
-
110
- - Vue 3で`TypeScript`を使用する場合:
71
+ Vue 3で ` TypeScript ` を使用する場合:
111
72
112
73
``` html
113
74
<template >
@@ -135,10 +96,8 @@ export default {
135
96
const background = ref (' #ffffff' )
136
97
const foreground = ref (' #000000' )
137
98
const margin = ref (0 )
138
- const gradient = ref (false )
139
- const gradientType = ref< GradientType> (' linear' )
140
- const gradientStartColor = ref (' #000000' )
141
- const gradientEndColor = ref (' #38bdf8' )
99
+
100
+ // 画像の設定
142
101
const imageSettings = ref< ImageSettings> ({
143
102
src: ' https://github.com/scopewu.png' ,
144
103
width: 30 ,
@@ -147,6 +106,12 @@ export default {
147
106
// y: 10,
148
107
excavate: true ,
149
108
})
109
+
110
+ // グラデーション
111
+ const gradient = ref (false )
112
+ const gradientType = ref< GradientType> (' linear' )
113
+ const gradientStartColor = ref (' #000000' )
114
+ const gradientEndColor = ref (' #38bdf8' )
150
115
</script >
151
116
```
152
117
@@ -201,6 +166,24 @@ QRコードの背景色。
201
166
202
167
QRコードの前景色。
203
168
169
+ ### ` image-settings `
170
+
171
+ - タイプ: ` ImageSettings `
172
+ - デフォルト: ` {} `
173
+
174
+ ``` ts
175
+ export type ImageSettings = {
176
+ src: string , // The URL of image.
177
+ x? : number , // The horizontal offset. When not specified, will center the image.
178
+ y? : number , // The vertical offset. When not specified, will center the image.
179
+ height: number , // The height of image
180
+ width: number , // The height of image
181
+ excavate? : boolean , // Whether or not to "excavate" the modules around the image.
182
+ }
183
+ ` ` `
184
+
185
+ The settings to support qrcode image logo.
186
+
204
187
### ` gradient `
205
188
206
189
- タイプ: ` boolean `
@@ -229,24 +212,6 @@ QRコードのグラデーション塗りつぶしを有効にします。
229
212
230
213
グラデーションの終了色。
231
214
232
- ### ` image-settings `
233
-
234
- - タイプ: ` ImageSettings `
235
- - デフォルト: ` {} `
236
-
237
- ``` ts
238
- export type ImageSettings = {
239
- src: string , // The URL of image.
240
- x? : number , // The horizontal offset. When not specified, will center the image.
241
- y? : number , // The vertical offset. When not specified, will center the image.
242
- height: number , // The height of image
243
- width: number , // The height of image
244
- excavate? : boolean , // Whether or not to "excavate" the modules around the image.
245
- }
246
- ` ` `
247
-
248
- The settings to support qrcode image logo.
249
-
250
215
### ` class `
251
216
252
217
- タイプ: ` string `
0 commit comments