File tree 2 files changed +6
-5
lines changed 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -60,14 +60,14 @@ func (m *Model) Repeat() {
60
60
61
61
func (m * Model ) PopulateTodo () {
62
62
// 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 () {
63
68
// so it's better to use VueJS ops to manipulates the array
64
- // m.Todos = append(m.Todos, NewTodo(m.Str))
65
69
vm := vue .GetVM (m )
66
70
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))
71
71
vue .Push (todos , NewTodo (m .Str ))
72
72
}
73
73
Original file line number Diff line number Diff line change 30
30
< button @click ="Inc "> Inc</ button >
31
31
< button @click ="Repeat "> Repeat</ button >
32
32
< button @click ="PopulateTodo "> PopulateTodo</ button >
33
+ < button @click ="PopulateTodo2 "> PopulateTodo2</ button >
33
34
< button @click ="ShiftTodo "> ShiftTodo</ button >
34
35
< button @click ="MapTodos "> MapTodos</ button >
35
36
< li v-for ="item in list ">
You can’t perform that action at this time.
0 commit comments