Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7ae7446

Browse filesBrowse files
committed
refine features example
1 parent 88ef33b commit 7ae7446
Copy full SHA for 7ae7446

File tree

2 files changed

+6
-5
lines changed
Filter options

2 files changed

+6
-5
lines changed

‎examples/features/features.go

Copy file name to clipboardExpand all lines: examples/features/features.go
+5-5Lines 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

Copy file name to clipboardExpand all lines: examples/features/index.html
+1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.