Skip to content

Commit 215d4d1

Browse files
committed
docs: polish installation instructions
1 parent e62f108 commit 215d4d1

File tree

1 file changed

+32
-51
lines changed

1 file changed

+32
-51
lines changed

README.md

Lines changed: 32 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -110,47 +110,23 @@ The newest API these components depend on is the [FileReader API](https://canius
110110
- Drag-and-drop is not supported on mobile
111111
- Home screen web apps on iOS prior to 11.3 don't support `QrcodeCapture` (see [this StackOverflow question](https://stackoverflow.com/questions/46228218/how-to-access-camera-on-ios11-home-screen-web-app))
112112

113-
# Troubleshooting :zap:
114-
115-
#### I don't see the camera when using `QrcodeStream`.
116-
117-
- Check if it works on the demo page. Especially the [Decode All](https://gruhn.github.io/vue-qrcode-reader/demos/DecodeAll.html) demo, since it renders error messages. If you see errors, consult the docs to understand their meaning.
118-
- Demo works but not locally: Listen for the `init` event to investigate errors.
119-
- Demo doesn't work: Carefully review the Browser Support section above. Maybe your device is just not supported.
120-
121-
#### I'm running a dev server on localhost. How to test on my mobile device without HTTPS?
122-
123-
- If your setup is Desktop Chrome + Android Chrome, use [Remote Debugging](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/) which allows your Android device to [access your local server as localhost](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/local-server).
124-
- Otherwise use a reverse proxy like [ngrok](https://ngrok.com/) or [serveo](https://serveo.net/) to temporarily make your local server publicly available with HTTPS.
125-
- There are also loads of serverless/static hosting services that have HTTPS enabled by default and where you can deploy your web app for free. For example _GitHub Pages_, _Google Firebase_, _Netlify_, ...
126-
127-
#### Some of my QR codes are not being detected.
128-
129-
- Make sure, there is some white border around the QR code.
130-
- Color inverted QR codes are not supported (dark background, light foreground).
131-
- [Model 1 QR codes](https://en.wikipedia.org/wiki/QR_code#Model_1) are also not supported.
132-
133113
# Installation :package:
134114

135-
```bash
136-
npm install vue-qrcode-reader
137-
```
115+
## Module import
138116

139-
or with Yarn:
117+
Run:
140118

141119
```bash
142-
yarn add vue-qrcode-reader
120+
npm install vue-qrcode-reader
143121
```
144122

145-
## Default import
146-
147-
You can either import the components independantly and register them in another
148-
components scope:
123+
Either import the components independantly for local registration:
149124

150125
```javascript
151126
import { QrcodeStream, QrcodeDropZone, QrcodeCapture } from 'vue-qrcode-reader'
152127

153-
Vue.component('my-component', {
128+
const MyComponent = {
129+
154130
components: {
155131
QrcodeStream,
156132
QrcodeDropZone,
@@ -161,7 +137,7 @@ Vue.component('my-component', {
161137
))
162138
```
163139
164-
Or alternatively register all of them globally right away:
140+
Or register all of them globally right away:
165141
166142
```javascript
167143
import Vue from "vue";
@@ -172,36 +148,41 @@ Vue.use(VueQrcodeReader);
172148
173149
**⚠️ A css file is included when importing the package. You may have to setup your bundler to embed the css in your page.**
174150
175-
## Browser
176-
177-
> All the examples on the demo page utilize [single-file components](https://vuejs.org/v2/guide/single-file-components.html). To use them in your project you need a build tool like webpack. Check out [this fiddle](https://jsfiddle.net/2bfohnax/) for a simpler example you can use right in the browser.
151+
## Classic import
178152
179-
Besides Vue you need to include the following CSS and JS file:
153+
Vue itself must be included first. Then add the following CSS and JS file:
180154
181155
- `<link href="`[vue-qrcode-reader.css](https://unpkg.com/vue-qrcode-reader/dist/vue-qrcode-reader.css)`" rel="stylesheet">`
182156
- `<script src="`[vue-qrcode-reader.browser.js](https://unpkg.com/vue-qrcode-reader/dist/vue-qrcode-reader.browser.js)`"></script>`
183157
184-
The global variable `window.VueQrcodeReader` should now be available.
158+
All components are automatically registered globally.
159+
Use kebab-case to reference them in your templates:
185160
186-
All components should be automatically registered globally. If not, you can do it like this:
187-
188-
```javascript
189-
Vue.use(VueQrcodeReader);
161+
```html
162+
<qrcode-stream></qrcode-stream>
163+
<qrcode-drop-zone></qrcode-drop-zone>
164+
<qrcode-capture></qrcode-capture>
190165
```
191166
192-
You can also register specific components locally, in one of your components:
167+
# Troubleshooting :zap:
193168
194-
```javascript
195-
Vue.component('my-component', {
196-
components: {
197-
'qrcode-stream': VueQrcodeReader.QrcodeStream,
198-
'qrcode-drop-zone': VueQrcodeReader.QrcodeDropZone,
199-
'qrcode-capture': VueQrcodeReader.QrcodeCapture
200-
},
169+
#### I don't see the camera when using `QrcodeStream`.
201170
202-
// ...
203-
)
204-
```
171+
- Check if it works on the demo page. Especially the [Decode All](https://gruhn.github.io/vue-qrcode-reader/demos/DecodeAll.html) demo, since it renders error messages. If you see errors, consult the docs to understand their meaning.
172+
- Demo works but not locally: Listen for the `init` event to investigate errors.
173+
- Demo doesn't work: Carefully review the Browser Support section above. Maybe your device is just not supported.
174+
175+
#### I'm running a dev server on localhost. How to test on my mobile device without HTTPS?
176+
177+
- If your setup is Desktop Chrome + Android Chrome, use [Remote Debugging](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/) which allows your Android device to [access your local server as localhost](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/local-server).
178+
- Otherwise use a reverse proxy like [ngrok](https://ngrok.com/) or [serveo](https://serveo.net/) to temporarily make your local server publicly available with HTTPS.
179+
- There are also loads of serverless/static hosting services that have HTTPS enabled by default and where you can deploy your web app for free. For example _GitHub Pages_, _Google Firebase_, _Netlify_, ...
180+
181+
#### Some of my QR codes are not being detected.
182+
183+
- Make sure, there is some white border around the QR code.
184+
- Color inverted QR codes are not supported (dark background, light foreground).
185+
- [Model 1 QR codes](https://en.wikipedia.org/wiki/QR_code#Model_1) are also not supported.
205186
206187
# Thanks :pray:
207188

0 commit comments

Comments
 (0)