Nuxt/examples/middleware/pages/_slug.vue

28 lines
527 B
Vue
Raw Normal View History

2017-02-03 14:09:27 +00:00
<template>
<div>
<h1>{{ $route.params.slug || 'Home' }}</h1>
<pre>{{ userAgent }}</pre>
<ul>
<li><nuxt-link to="/">Home</nuxt-link></li>
2017-11-26 13:40:57 +00:00
<li v-for="(slug, index) in slugs" :key="index">
<nuxt-link :to="{ name: 'slug', params: { slug } }">{{ slug }}</nuxt-link>
</li>
2017-02-03 14:09:27 +00:00
</ul>
</div>
</template>
<script>
export default {
2017-10-31 13:43:55 +00:00
asyncData({ store, route, userAgent }) {
2017-02-03 14:09:27 +00:00
return {
userAgent,
slugs: [
'foo',
'bar',
'baz'
]
}
}
}
</script>