New Features
Using aync/await 🔥
You can use async/await in your components, the best use case is the asynchronous data
method.
Example: pages/posts/_id.vue
<template>
<div>
<h1>{{ post.title }}</h1>
<pre>{{ post.body }}</pre>
</div>
</template>
<script>
import axios from 'axios'
export default {
async data ({ params }) {
// We can now use ES7 async/await
let { data } = await axios.get(`https://jsonplaceholder.typicode.com/posts/${params.id}`)
return { post: data }
}
}
</script>
See the updated documentation.
Extend webpack configuration
Add extend(webpackConfig, { dev, isClient, isServer })
option in the build
configuration. This option let you extend the webpack configuration for your application, this is for advanced users.
Example: nuxt.config.js
module.exports = {
build: {
extend (config, { dev, isClient }) {
// config is the webpack config
// dev is a boolean, equals false when `nuxt build`
// isClient is a boolean, let you know when you extend
// the config for the client bundle or the server bundle
config.devtool = (dev ? 'eval-source-map' : false)
}
}
Scroll to the top in page components
Add scrollToTop: true/false
option in page component (default: false
), this option, when set to true will force the router to scroll to the top of the page (used for children routes).
Core updates
- The build of Nuxt.js does not use
babel-polyfill
but directly the required polyfills
Bug fixes
- Fix the component data on hot-reloading (bug fix) when navigating trough the app