Nuxt/examples/async-data/pages/index.vue

37 lines
573 B
Vue
Raw Normal View History

<template>
2016-12-27 15:57:50 +00:00
<div class="container">
<h1>User Agent</h1>
<p>{{ userAgent }}</p>
2016-12-27 15:57:50 +00:00
<p><nuxt-link to="/posts">Blog</nuxt-link></p>
</div>
</template>
<script>
export default {
data ({ req }, callback) {
setTimeout(function () {
// callback(err, data)
callback(null, {
userAgent: (req ? req.headers['user-agent'] : navigator.userAgent)
})
}, 100)
}
}
</script>
2016-11-07 13:12:59 +00:00
<style scoped>
2016-12-27 15:57:50 +00:00
.container {
width: 70%;
margin: auto;
text-align: center;
padding-top: 100px;
}
p {
font-size: 20px;
2016-12-27 15:57:50 +00:00
}
a {
color: #41B883;
}
</style>