Permalink
Browse files

Vue.js: Update to 2.1.8 (#1734)

1 parent 50d46b4 commit ae2dd19588f551032233a66bbc262cf9dba3b1ff @sun-zheng-an sun-zheng-an committed with passy Dec 31, 2016
Showing with 8,525 additions and 10,343 deletions.
  1. +4 −4 examples/vue/index.html
  2. +9 −8 examples/vue/js/app.js
  3. +8,511 −10,330 examples/vue/node_modules/vue/dist/vue.js
  4. +1 −1 examples/vue/package.json
@@ -8,12 +8,12 @@
<style> [v-cloak] { display: none; } </style>
</head>
<body>
- <section class="todoapp">
+ <section class="todoapp" v-cloak>
<header class="header">
<h1>todos</h1>
<input class="new-todo" autofocus autocomplete="off" placeholder="What needs to be done?" v-model="newTodo" @keyup.enter="addTodo">
</header>
- <section class="main" v-show="todos.length" v-cloak>
+ <section class="main" v-show="todos.length">
<input class="toggle-all" type="checkbox" v-model="allDone">
<ul class="todo-list">
<li class="todo" v-for="todo in filteredTodos" :class="{completed: todo.completed, editing: todo == editedTodo}">
@@ -26,9 +26,9 @@
</li>
</ul>
</section>
- <footer class="footer" v-show="todos.length" v-cloak>
+ <footer class="footer" v-show="todos.length">
<span class="todo-count">
- <strong v-text="remaining"></strong> {{remaining | pluralize 'item'}} left
+ <strong v-text="remaining"></strong> {{pluralize('item', remaining)}} left
</span>
<ul class="filters">
<li><a href="#/all" :class="{selected: visibility == 'all'}">All</a></li>
@@ -66,6 +66,10 @@
// note there's no DOM manipulation here at all.
methods: {
+ pluralize: function (word, count) {
+ return word + (count === 1 ? '' : 's');
+ },
+
addTodo: function () {
var value = this.newTodo && this.newTodo.trim();
if (!value) {
@@ -76,7 +80,8 @@
},
removeTodo: function (todo) {
- this.todos.$remove(todo);
+ var index = this.todos.indexOf(todo);
+ this.todos.splice(index, 1);
},
editTodo: function (todo) {
@@ -109,14 +114,10 @@
// before focusing on the input field.
// http://vuejs.org/guide/custom-directive.html
directives: {
- 'todo-focus': function (value) {
- if (!value) {
- return;
- }
- var el = this.el;
- Vue.nextTick(function () {
+ 'todo-focus': function (el, binding) {
+ if (binding.value) {
el.focus();
- });
+ }
}
}
});
Oops, something went wrong.

0 comments on commit ae2dd19

Please sign in to comment.