File tree Expand file tree Collapse file tree 3 files changed +76
-55
lines changed Expand file tree Collapse file tree 3 files changed +76
-55
lines changed Original file line number Diff line number Diff line change 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 >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,8 +6,10 @@ var helpers = require('./helpers')
66Vue . use ( VueFire )
77
88var 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
1315describe ( 'VueFire' , function ( ) {
You can’t perform that action at this time.
0 commit comments