Skip to content

Commit a14f98d

Browse files
chrisvfritzposva
authored andcommitted
update vuefire example for 2.0 (#34)
* update vuefire example for 2.0 * update firebase app in tests
1 parent ca54673 commit a14f98d

File tree

3 files changed

+76
-55
lines changed

3 files changed

+76
-55
lines changed

examples/todo-app/index.html

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>VueFire Todo App Demo</title>
6+
<script src="https://www.gstatic.com/firebasejs/3.4.0/firebase.js"></script>
7+
<script src="https://unpkg.com/vue/dist/vue.js"></script>
8+
<script src="../../dist/vuefire.js"></script>
9+
</head>
10+
<body>
11+
12+
<!--
13+
Before running this example, make sure to:
14+
15+
1. cd path/to/vuefire
16+
2. npm install
17+
3. npm run build
18+
19+
Then you can open this file in your browser.
20+
If you just prefer to see this example with
21+
the latest published version of VueFire, you
22+
play with the code in this fiddle:
23+
24+
https://jsfiddle.net/chrisvfritz/acy5n6j6/
25+
-->
26+
27+
<div id="app">
28+
<input
29+
v-model.trim="newTodoText"
30+
@keyup.enter="addTodo"
31+
placeholder="Add new todo"
32+
>
33+
<ul>
34+
<li v-for="todo in todos">
35+
{{ todo.text }}
36+
<button @click="removeTodo(todo)">X</button>
37+
</li>
38+
</ul>
39+
</div>
40+
41+
<script>
42+
/* global Vue, firebase */
43+
var db = firebase.initializeApp({
44+
databaseURL: 'https://vuefiredemo.firebaseio.com'
45+
}).database()
46+
var todosRef = db.ref('todos')
47+
48+
new Vue({
49+
el: '#app',
50+
data: {
51+
newTodoText: ''
52+
},
53+
firebase: {
54+
todos: todosRef.limitToLast(25)
55+
},
56+
methods: {
57+
addTodo: function () {
58+
if (this.newTodoText) {
59+
todosRef.push({
60+
text: this.newTodoText
61+
})
62+
this.newTodoText = ''
63+
}
64+
},
65+
removeTodo: function (todo) {
66+
todosRef.child(todo['.key']).remove()
67+
}
68+
}
69+
})
70+
</script>
71+
</body>
72+
</html>

examples/todoApp/index.html

Lines changed: 0 additions & 53 deletions
This file was deleted.

tests/vuefire.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ var helpers = require('./helpers')
66
Vue.use(VueFire)
77

88
var firebaseApp = Firebase.initializeApp({
9-
apiKey: helpers.generateRandomString(),
10-
databaseURL: 'https://' + helpers.generateRandomString() + '.firebaseio-demo.com'
9+
apiKey: 'AIzaSyC3eBV8N95k_K67GTfPqf67Mk1P-IKcYng',
10+
authDomain: 'oss-test.firebaseapp.com',
11+
databaseURL: 'https://oss-test.firebaseio.com',
12+
storageBucket: 'oss-test.appspot.com'
1113
})
1214

1315
describe('VueFire', function () {

0 commit comments

Comments
 (0)