Skip to content

Commit e747778

Browse files
committed
Update demo
1 parent 3784fb9 commit e747778

File tree

5 files changed

+103
-2
lines changed

5 files changed

+103
-2
lines changed

demo/src/App.vue

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717
<h2>Essential Links</h2>
1818
<nav>
1919
<ul>
20+
<li>
21+
<router-link
22+
to="login"
23+
title="Go to example login page"
24+
aria-label="Go to example login page"
25+
>
26+
Login
27+
</router-link>
28+
</li>
2029
<li>
2130
<router-link
2231
to="/posts/1"

demo/src/main.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import VueAnnouncer from '../vue-announcer'
44
import App from './App.vue'
55
import router from './router.js'
66

7+
import spell from './plugins/announcer/spell'
8+
79
Vue.use(VueHead)
8-
Vue.use(VueAnnouncer, {}, router)
10+
Vue.use(VueAnnouncer, { plugins: [spell] }, router)
911
Vue.config.productionTip = false
1012

1113
/* eslint-disable no-new */

demo/src/pages/Login.vue

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<template>
2+
<div class="login-container">
3+
<h2>Login Page</h2>
4+
5+
<form
6+
id="form-login"
7+
name="form-login"
8+
>
9+
<div>
10+
<label for="email">
11+
<span style="display: block;text-align:left;">Email</span>
12+
<input
13+
id="email"
14+
v-model="email"
15+
name="email"
16+
type="email"
17+
>
18+
</label>
19+
</div>
20+
<div>
21+
<label for="password">
22+
<span style="display: block;text-align:left;">Password</span>
23+
<input
24+
id="password"
25+
v-model="password"
26+
name="password"
27+
type="password"
28+
>
29+
</label>
30+
<button
31+
type="button"
32+
@click="$announcer.plugins.spell(password)"
33+
>
34+
Spell the password
35+
</button>
36+
</div>
37+
</form>
38+
</div>
39+
</template>
40+
41+
<script>
42+
export default {
43+
name: 'Login',
44+
45+
data: () => ({
46+
email: null,
47+
password: null,
48+
spelling: false
49+
}),
50+
51+
watch: {
52+
password (val) {
53+
if (this.spelling) this.$announcer.assertive(val.substr(-1, 1))
54+
}
55+
}
56+
}
57+
</script>
58+
59+
<style>
60+
.login-container {
61+
max-width: 400px;
62+
margin: 0 auto;
63+
}
64+
65+
#form-login > div {
66+
margin-bottom: 20px;
67+
}
68+
69+
#form-login label > span {
70+
display: block;
71+
text-align:left;
72+
margin-bottom: 6px;
73+
}
74+
75+
#form-login input {
76+
width: 100%;
77+
padding: 10px;
78+
}
79+
80+
#form-login button {
81+
padding: 4px;
82+
margin-top: 10px;
83+
}
84+
</style>

demo/src/router.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import About from '@/pages/About'
22
import Contact from '@/pages/Contact'
33
import Home from '@/pages/Home'
44
import Post from '@/pages/Post'
5+
import Login from '@/pages/Login'
56
import Vue from 'vue'
67
import VueRouter from 'vue-router'
78

8-
99
Vue.use(VueRouter)
1010

1111
const router = new VueRouter({
@@ -21,6 +21,11 @@ const router = new VueRouter({
2121
}
2222
}
2323
},
24+
{
25+
name: 'login',
26+
path: '/login',
27+
component: Login
28+
},
2429
{
2530
name: 'about',
2631
path: '/about',

docs/.vuepress/styles/palette.styl

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$contentMaxWidth = 960px

0 commit comments

Comments
 (0)