mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
Merge branch 'master' into 0.10.0
This commit is contained in:
commit
09b019f6ec
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,7 +3,7 @@ yarn.lock
|
||||
node_modules
|
||||
|
||||
# logs
|
||||
npm-debug.log
|
||||
*.log
|
||||
|
||||
# other
|
||||
.nuxt
|
||||
|
@ -15,13 +15,32 @@ if (process.argv.indexOf('--analyze') !== -1 || process.argv.indexOf('-a') !== -
|
||||
process.argv = without(process.argv, '--analyze', '-a')
|
||||
}
|
||||
|
||||
var nuxtConfigFileName = 'nuxt.config.js'
|
||||
|
||||
// --config-file option
|
||||
var indexOfConfig = false
|
||||
if (process.argv.indexOf('--config-file') !== -1) {
|
||||
indexOfConfig = process.argv.indexOf('--config-file')
|
||||
} else if (process.argv.indexOf('-c') !== -1) {
|
||||
indexOfConfig = process.argv.indexOf('-c')
|
||||
}
|
||||
|
||||
if (indexOfConfig !== false) {
|
||||
nuxtConfigFileName = process.argv.slice(indexOfConfig)[1]
|
||||
process.argv = without(process.argv, '--config-file', '-c', nuxtConfigFileName)
|
||||
}
|
||||
|
||||
// Root directory parameter
|
||||
var rootDir = resolve(process.argv.slice(2)[0] || '.')
|
||||
var nuxtConfigFile = resolve(rootDir, 'nuxt.config.js')
|
||||
var nuxtConfigFilePath = resolve(rootDir, nuxtConfigFileName)
|
||||
|
||||
var options = {}
|
||||
if (fs.existsSync(nuxtConfigFile)) {
|
||||
options = require(nuxtConfigFile)
|
||||
if (fs.existsSync(nuxtConfigFilePath)) {
|
||||
options = require(nuxtConfigFilePath)
|
||||
} else {
|
||||
console.log(`Could not locate ${nuxtConfigFilePath}`) // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
if (typeof options.rootDir !== 'string') {
|
||||
options.rootDir = rootDir
|
||||
}
|
||||
|
2
examples/with-firebase/.gitignore
vendored
Normal file
2
examples/with-firebase/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
.nuxt
|
31
examples/with-firebase/README.md
Normal file
31
examples/with-firebase/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
# nuxt-firebase
|
||||
|
||||
> Nuxt.js with Firebase (REST API)
|
||||
|
||||
[DEMO](https://nuxt-firebase.now.sh/)
|
||||
|
||||
## About
|
||||
|
||||
This project uses [Firebase](https://firebase.google.com/). The tools and infrastructure you need to build better apps and grow successful businesses.
|
||||
|
||||
You can view the Firebase data at [https://nuxt-firebase.firebaseio.com/.json](https://nuxt-firebase.firebaseio.com/.json). This is what the App will consume.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Download this example [or clone the repo](https://github.com/nuxt/nuxt.js):
|
||||
|
||||
```bash
|
||||
curl https://codeload.github.com/nuxt/nuxt.js/tar.gz/master | tar -xz --strip=2 nuxt.js-master/examples/with-firebase
|
||||
cd with-firebase
|
||||
```
|
||||
|
||||
Install and run:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run dev
|
||||
|
||||
# or with Yarn
|
||||
yarn
|
||||
yarn dev
|
||||
```
|
27
examples/with-firebase/layouts/default.vue
Normal file
27
examples/with-firebase/layouts/default.vue
Normal file
@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<nav>
|
||||
<h1 @click="$router.push('/')">Nuxt.js + Firebase</h1>
|
||||
</nav>
|
||||
</div>
|
||||
<nuxt/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
padding-top: 1.5rem;
|
||||
}
|
||||
|
||||
nav {
|
||||
padding: 1.5rem 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
</style>
|
14
examples/with-firebase/nuxt.config.js
Normal file
14
examples/with-firebase/nuxt.config.js
Normal file
@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
head: {
|
||||
meta: [
|
||||
{ charset: 'utf-8' },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
|
||||
],
|
||||
link: [
|
||||
{ rel: 'stylesheet', href: 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css' }
|
||||
]
|
||||
},
|
||||
build: {
|
||||
vendor: ['axios']
|
||||
}
|
||||
}
|
20
examples/with-firebase/package.json
Normal file
20
examples/with-firebase/package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "nuxt-firebase",
|
||||
"version": "1.0.0",
|
||||
"description": "Nuxt.js with Firebase",
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
"build": "nuxt build",
|
||||
"start": "nuxt start"
|
||||
},
|
||||
"keywords": [
|
||||
"nuxt",
|
||||
"firebase"
|
||||
],
|
||||
"author": "Charlie Hield",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.15.3",
|
||||
"nuxt": "^0.9.9"
|
||||
}
|
||||
}
|
41
examples/with-firebase/pages/index.vue
Normal file
41
examples/with-firebase/pages/index.vue
Normal file
@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<div>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Avatar</th>
|
||||
<th>Name</th>
|
||||
<th>Title</th>
|
||||
<th>Profile</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(user, key) in users">
|
||||
<td>
|
||||
<nuxt-link :to="{ path: `/users/${key}`}">
|
||||
<img :src="user.avatar" class="rounded" alt="avatar">
|
||||
</nuxt-link>
|
||||
</td>
|
||||
<td>{{ user.name }}</td>
|
||||
<td>{{ user.title }}</td>
|
||||
<td>
|
||||
<nuxt-link :to="{ path: `/users/${key}`}">View profile →</nuxt-link>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from '~plugins/axios'
|
||||
|
||||
export default {
|
||||
async data() {
|
||||
const { data } = await axios.get('users.json')
|
||||
return {
|
||||
users: data
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
25
examples/with-firebase/pages/users/_key.vue
Normal file
25
examples/with-firebase/pages/users/_key.vue
Normal file
@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<div class="card" style="width: 20rem;">
|
||||
<div class="card-block">
|
||||
<img :src="user.avatar" class="rounded" alt="avatar"> <br><br>
|
||||
<h4 class="card-title">{{ user.name }}</h4>
|
||||
<h6 class="card-subtitle mb-2 text-muted">{{ user.title }}</h6>
|
||||
<p class="card-text">{{ user.description }}</p>
|
||||
<a href="#" class="btn btn-primary">Hire {{ user.name.split(' ')[0] }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from '~plugins/axios'
|
||||
|
||||
export default {
|
||||
async data({ route }) {
|
||||
const { key } = route.params
|
||||
const { data } = await axios.get(`users/${key}.json`)
|
||||
return {
|
||||
user: data
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
5
examples/with-firebase/plugins/axios.js
Normal file
5
examples/with-firebase/plugins/axios.js
Normal file
@ -0,0 +1,5 @@
|
||||
import axios from 'axios'
|
||||
|
||||
export default axios.create({
|
||||
baseURL: 'https://nuxt-firebase.firebaseio.com'
|
||||
})
|
4
examples/with-vuetify/README.md
Normal file
4
examples/with-vuetify/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Using Vuetify.js with Nuxt.js
|
||||
|
||||
https://nuxtjs.org/examples/with-vuetify
|
||||
https://vuetifyjs.com/
|
6
examples/with-vuetify/layouts/default.vue
Normal file
6
examples/with-vuetify/layouts/default.vue
Normal file
@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<nuxt/>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
</div>
|
||||
</template>
|
7
examples/with-vuetify/nuxt.config.js
Normal file
7
examples/with-vuetify/nuxt.config.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
build: {
|
||||
vendor: ['vuetify']
|
||||
},
|
||||
plugins: ['~plugins/vuetify.js'],
|
||||
css: ['vuetify/dist/vuetify.min.css']
|
||||
}
|
12
examples/with-vuetify/package.json
Normal file
12
examples/with-vuetify/package.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "with-vuetify",
|
||||
"dependencies": {
|
||||
"nuxt": "latest",
|
||||
"vuetify": "^0.9.1"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
"build": "nuxt build",
|
||||
"start": "nuxt start"
|
||||
}
|
||||
}
|
40
examples/with-vuetify/pages/index.vue
Normal file
40
examples/with-vuetify/pages/index.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<v-app top-toolbar left-fixed-sidebar>
|
||||
<v-toolbar>
|
||||
<v-toolbar-side-icon @click.native.stop="sidebar = !sidebar" />
|
||||
<v-toolbar-logo>Toolbar</v-toolbar-logo>
|
||||
</v-toolbar>
|
||||
<main>
|
||||
<v-sidebar left fixed drawer v-model="sidebar">
|
||||
<v-list>
|
||||
<v-list-item v-for="i in 3">
|
||||
<v-list-tile>
|
||||
<v-list-tile-title>Item {{ i }}</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-sidebar>
|
||||
<v-content>
|
||||
<v-container fluid>
|
||||
<div class="title">Main Content</div>
|
||||
</v-container>
|
||||
</v-content>
|
||||
</main>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
sidebar: false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.title {
|
||||
padding-left: 20px;
|
||||
}
|
||||
</style>
|
4
examples/with-vuetify/plugins/vuetify.js
Normal file
4
examples/with-vuetify/plugins/vuetify.js
Normal file
@ -0,0 +1,4 @@
|
||||
import Vue from 'vue'
|
||||
import Vuetify from 'vuetify'
|
||||
|
||||
Vue.use(Vuetify)
|
Loading…
Reference in New Issue
Block a user