Skip to content

Commit 2399b01

Browse files
committed
Updating example with new features
1 parent c5152dc commit 2399b01

File tree

6 files changed

+50
-58
lines changed

6 files changed

+50
-58
lines changed

example/src/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import Vue from 'vue'
2-
import App from './App.vue'
3-
import router from './router.js'
4-
52
import VueHead from 'vue-head'
63
import Toasted from 'vue-toasted'
74
import VueAnnouncer from '../vue-announcer'
5+
import App from './App.vue'
6+
import router from './router.js'
7+
88

99
Vue.use(VueHead)
1010
Vue.use(Toasted, {

example/src/pages/About.vue

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,34 @@
22
<div>
33
<h2>About Page</h2>
44
<!-- data-va is used for internal testing, it is not required -->
5-
<button type="button" data-va="toasted" @click="notify">
5+
<button
6+
type="button"
7+
data-va="toasted"
8+
@click="notify"
9+
>
610
trigger notification
711
</button>
812
</div>
913
</template>
1014

1115
<script>
12-
export default {
13-
name: 'About',
14-
head: {
15-
title: {
16-
inner: 'About page'
17-
}
18-
},
19-
methods: {
20-
notify () {
21-
let message = `Hi, it's a toasted notification`
22-
this.$toasted.success(message)
23-
this.$announcer.set(message)
24-
}
16+
export default {
17+
name: 'About',
18+
methods: {
19+
notify () {
20+
const message = 'Hi, it\'s a toasted notification'
21+
this.$toasted.success(message)
22+
this.$announcer.set(message)
23+
}
24+
},
25+
head: {
26+
title: {
27+
inner: 'About page'
2528
}
2629
}
30+
}
2731
</script>
2832

2933
<style>
3034
31-
</style>
35+
</style>

example/src/pages/Contact.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
</template>
66

77
<script>
8-
export default {
9-
name: 'Contact',
10-
head: {
11-
title: {
12-
inner: 'Contact page'
13-
}
8+
export default {
9+
name: 'Contact',
10+
head: {
11+
title: {
12+
inner: 'Contact page'
1413
}
1514
}
15+
}
1616
</script>
1717

1818
<style>
1919
20-
</style>
20+
</style>

example/src/pages/Home.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
</template>
66

77
<script>
8-
export default {
9-
name: 'Home'
10-
}
8+
export default {
9+
name: 'Home'
10+
}
1111
</script>
1212

1313
<style>
1414
15-
</style>
15+
</style>

example/src/router.js

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,40 @@
1+
import About from '@/pages/About'
2+
import Contact from '@/pages/Contact'
3+
import Home from '@/pages/Home'
14
import Vue from 'vue'
25
import VueRouter from 'vue-router'
36

4-
import Home from '@/pages/Home'
5-
import About from '@/pages/About'
6-
import Contact from '@/pages/Contact'
77

88
Vue.use(VueRouter)
99

1010
const router = new VueRouter({
1111
mode: 'history',
1212
routes: [
1313
{
14-
beforeEnter (to, from, next) {
15-
router.app.$announcer.setComplementRoute('has loaded')
16-
17-
next()
18-
},
1914
name: 'home',
2015
path: '/',
2116
component: Home,
2217
meta: {
23-
announcer: 'Home page'
18+
announcer: {
19+
message: 'Home page',
20+
complementRoute: 'has loaded'
21+
}
2422
}
2523
},
2624
{
27-
beforeEnter (to, from, next) {
28-
router.app.$announcer.setComplementRoute('has loaded')
29-
30-
next()
31-
},
3225
name: 'about',
3326
path: '/about',
34-
component: About,
35-
meta: {
36-
announcer: 'About page'
37-
}
27+
component: About
3828
},
3929
{
40-
beforeEnter (to, from, next) {
41-
router.app.$announcer.setComplementRoute('has fully loaded')
42-
43-
next()
44-
},
4530
name: 'contact',
4631
path: '/contact',
4732
component: Contact,
4833
meta: {
49-
announcer: 'Contact page'
34+
announcer: {
35+
politeness: 'assetive',
36+
complementRoute: 'has fully loaded'
37+
}
5038
}
5139
}
5240
]

example/webpack.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var path = require('path')
2-
var webpack = require('webpack')
1+
const path = require('path')
2+
const webpack = require('webpack')
33

44
module.exports = {
55
entry: './src/main.js',
@@ -15,8 +15,8 @@ module.exports = {
1515
use: [
1616
'vue-style-loader',
1717
'css-loader'
18-
],
19-
}, {
18+
]
19+
}, {
2020
test: /\.vue$/,
2121
loader: 'vue-loader',
2222
options: {
@@ -41,7 +41,7 @@ module.exports = {
4141
},
4242
resolve: {
4343
alias: {
44-
'vue$': 'vue/dist/vue.esm.js',
44+
vue$: 'vue/dist/vue.esm.js',
4545
'@': path.resolve(__dirname, 'src/')
4646
},
4747
extensions: ['*', '.js', '.vue', '.json']

0 commit comments

Comments
 (0)