Evan You 12 лет назад
Родитель
Сommit
d5a0830ea2
2 измененных файлов с 9 добавлено и 2 удалено
  1. 2 2
      examples/todomvc/js/app.js
  2. 7 0
      examples/todomvc/js/routes.js

+ 2 - 2
examples/todomvc/js/app.js

@@ -5,7 +5,7 @@
     'use strict';
 
     var filters = {
-        all: function (todo) {
+        all: function () {
             return true;
         },
         active: function (todo) {
@@ -16,7 +16,7 @@
         }
     };
 
-    exports.app = new Vue({
+    var app = exports.app = new Vue({
 
         // the root element that will be compiled
         el: '#todoapp',

+ 7 - 0
examples/todomvc/js/routes.js

@@ -12,6 +12,13 @@
         });
     });
 
+    router.configure({
+        notfound: function () {
+            window.location.hash = '';
+            app.filter = 'all';
+        }
+    });
+
     router.init();
     
 })(app, Router);