Skip to content

Commit e168d12

Browse files
committed
Docs: Add demo and config to install announcer in nuxt.js
1 parent b998744 commit e168d12

File tree

4 files changed

+53
-4
lines changed

4 files changed

+53
-4
lines changed

docs/demos/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
99
></iframe>
1010
11-
<a href="https://codesandbox.io/s/vue-announcer-vue-project-z049t" target="_blank" rel="noopener">Open Sandbox example</a>
11+
<a href="https://codesandbox.io/s/vue-announcer-vue-project-z049t" target="_blank" rel="noopener">Open sandbox example</a>

docs/demos/nuxt.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
11
# Nuxt.js
22

3-
### Coming soon
3+
The first step is to create your plugin in Nuxt `plugins/vue-announcer.js`
4+
5+
```javascript
6+
import Vue from "vue";
7+
import VueAnnouncer from "@vue-a11y/announcer";
8+
9+
export default ({ app }) => {
10+
Vue.use(VueAnnouncer, {}, app.router);
11+
};
12+
```
13+
14+
After creating the plugin you need to add it in the nuxt settings, in the `nuxt.config.js` file, you can [learn more about it here](https://nuxtjs.org/api/configuration-plugins#__layout).
15+
16+
```javascript
17+
export default {
18+
// ...
19+
plugins: [
20+
{ src: "~/plugins/vue-announcer.js", mode: "client" }
21+
],
22+
}
23+
```
24+
25+
Now just add `<VueAnnouncer />` in your default layout.
26+
27+
In your `layouts/default.vue`
28+
```vue
29+
<template>
30+
<div>
31+
<VueAnnouncer /> <!-- You can place it anywhere in your application -->
32+
...
33+
</div>
34+
</template>
35+
```
36+
37+
<br />
38+
39+
---
40+
41+
### Demo
42+
<br />
43+
44+
<iframe
45+
src="https://codesandbox.io/embed/vue-announcer-nuxt-project-breih?fontsize=14&hidenavigation=1&module=%2Fplugins%2Fvue-announcer.js&theme=dark&view=editor"
46+
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
47+
title="vue-announcer-nuxt-project"
48+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr"
49+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
50+
></iframe>
51+
52+
<a href="https://codesandbox.io/s/vue-announcer-nuxt-project-breih" target="_blank" rel="noopener">Open sandbox example</a>

docs/guide/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ In your `App.vue`
2525
```vue
2626
<template>
2727
<div>
28-
<vue-announcer /> <!-- You can place it anywhere in your application -->
28+
<VueAnnouncer /> <!-- You can place it anywhere in your application -->
2929
...
3030
</div>
3131
</template>

example/src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div id="app">
33
<!-- data-va is used for internal testing, it is not required -->
4-
<vue-announcer data-va="announcer" />
4+
<VueAnnouncer data-va="announcer" />
55
<header>
66
<router-link
77
to="/"

0 commit comments

Comments
 (0)