Skip to content

Commit 7ae7446

Browse files
committed
refine features example
1 parent 88ef33b commit 7ae7446

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

examples/features/features.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ func (m *Model) Repeat() {
6060

6161
func (m *Model) PopulateTodo() {
6262
// using append would cause GopherJS internalization problems
63+
// but this way works with Todo has js.Object embeded
64+
m.Todos = append(m.Todos, NewTodo(m.Str))
65+
}
66+
67+
func (m *Model) PopulateTodo2() {
6368
// so it's better to use VueJS ops to manipulates the array
64-
// m.Todos = append(m.Todos, NewTodo(m.Str))
6569
vm := vue.GetVM(m)
6670
todos := vm.Get("todos")
67-
// println("ok 0", todos, todos.Get("length"))
68-
// println("ok 1", todos, todos.Length())
69-
// println("ok 2", m.Todos, len(m.Todos))
70-
// vue.Unshift(todos, NewTodo(m.Str))
7171
vue.Push(todos, NewTodo(m.Str))
7272
}
7373

examples/features/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<button @click="Inc">Inc</button>
3131
<button @click="Repeat">Repeat</button>
3232
<button @click="PopulateTodo">PopulateTodo</button>
33+
<button @click="PopulateTodo2">PopulateTodo2</button>
3334
<button @click="ShiftTodo">ShiftTodo</button>
3435
<button @click="MapTodos">MapTodos</button>
3536
<li v-for="item in list">

0 commit comments

Comments
 (0)