From 34f46720c301d9cba4f376d6c8c8193f3f755768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 27 Nov 2016 13:39:52 +0100 Subject: [PATCH] hello-world example like in the video --- examples/custom-routes/nuxt.config.js | 24 +++++++++++- examples/hello-world/package.json | 6 +-- examples/hello-world/pages/about.vue | 25 +----------- examples/hello-world/pages/index.vue | 15 ++------ examples/static-images/package.json | 11 ++++++ examples/static-images/pages/about.vue | 36 ++++++++++++++++++ examples/static-images/pages/index.vue | 15 ++++++++ .../static/nuxt-black.png | Bin .../static/nuxt.png | Bin 9 files changed, 91 insertions(+), 41 deletions(-) create mode 100644 examples/static-images/package.json create mode 100644 examples/static-images/pages/about.vue create mode 100644 examples/static-images/pages/index.vue rename examples/{hello-world => static-images}/static/nuxt-black.png (100%) rename examples/{hello-world => static-images}/static/nuxt.png (100%) diff --git a/examples/custom-routes/nuxt.config.js b/examples/custom-routes/nuxt.config.js index 5a1789baab..9c8e08af7a 100644 --- a/examples/custom-routes/nuxt.config.js +++ b/examples/custom-routes/nuxt.config.js @@ -1,7 +1,29 @@ +const axios = require('axios') + module.exports = { + env: { + token: 'Hello :)', + num: 3, + bool: true + }, router: { routes: [ - { name: 'user', path: '/users/:id', component: 'pages/_user' } + { name: 'user', path: '/users/:id(\\d+)', component: 'pages/_user' } ] + }, + build: { + vendor: ['axios'] + }, + generate: { + routeParams: { + '/users/:id(\\d+)': function () { + return axios.get('http://jsonplaceholder.typicode.com/users') + .then((res) => { + return res.data.map((user) => { + return { id: user.id } + }) + }) + } + } } } diff --git a/examples/hello-world/package.json b/examples/hello-world/package.json index 33d3b0501f..90075b7add 100644 --- a/examples/hello-world/package.json +++ b/examples/hello-world/package.json @@ -1,11 +1,9 @@ { - "name": "nuxt-hello-world", + "name": "hello-nuxt", "dependencies": { "nuxt": "latest" }, "scripts": { - "dev": "nuxt", - "build": "nuxt build", - "start": "nuxt start" + "dev": "nuxt" } } diff --git a/examples/hello-world/pages/about.vue b/examples/hello-world/pages/about.vue index 9f27ecf056..ed0dc56341 100755 --- a/examples/hello-world/pages/about.vue +++ b/examples/hello-world/pages/about.vue @@ -1,10 +1,5 @@ - - diff --git a/examples/hello-world/pages/index.vue b/examples/hello-world/pages/index.vue index 95aaf9fced..0f54495bd6 100755 --- a/examples/hello-world/pages/index.vue +++ b/examples/hello-world/pages/index.vue @@ -1,15 +1,6 @@ - - diff --git a/examples/static-images/package.json b/examples/static-images/package.json new file mode 100644 index 0000000000..33d3b0501f --- /dev/null +++ b/examples/static-images/package.json @@ -0,0 +1,11 @@ +{ + "name": "nuxt-hello-world", + "dependencies": { + "nuxt": "latest" + }, + "scripts": { + "dev": "nuxt", + "build": "nuxt build", + "start": "nuxt start" + } +} diff --git a/examples/static-images/pages/about.vue b/examples/static-images/pages/about.vue new file mode 100644 index 0000000000..9f27ecf056 --- /dev/null +++ b/examples/static-images/pages/about.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/examples/static-images/pages/index.vue b/examples/static-images/pages/index.vue new file mode 100644 index 0000000000..95aaf9fced --- /dev/null +++ b/examples/static-images/pages/index.vue @@ -0,0 +1,15 @@ + + + diff --git a/examples/hello-world/static/nuxt-black.png b/examples/static-images/static/nuxt-black.png similarity index 100% rename from examples/hello-world/static/nuxt-black.png rename to examples/static-images/static/nuxt-black.png diff --git a/examples/hello-world/static/nuxt.png b/examples/static-images/static/nuxt.png similarity index 100% rename from examples/hello-world/static/nuxt.png rename to examples/static-images/static/nuxt.png