示例#1
7
func (m Model) View(rootUpdateFunc, wrapFunc interface{}) h.HTML {
	return h.Div(
		m.top.View(rootUpdateFunc, top(m)),
		m.bottom.View(rootUpdateFunc, bottom(m)),
		h.Button(h.Text("Reset")).OnClick(rootUpdateFunc, rootUpdateFunc, Reset),
	)
}
示例#2
5
func (m Model) View(rootUpdateFunc, wrapFunc interface{}) h.HTML {
	remove := h.Button(h.Text("Remove")).OnClick(rootUpdateFunc, wrapper(m), Remove)
	insert := h.Button(h.Text("Add")).OnClick(rootUpdateFunc, wrapper(m), Insert)
	p := []h.HTML{remove, insert}
	for id, counter := range m.counters {
		p = append(p, counter.counter.View(rootUpdateFunc, cWrapper(m, id)))
	}
	return h.Div(p...)
}
示例#3
3
func (m Model) View(rootUpdateFunc, wrapFunc interface{}) h.HTML {
	var wf WrapFunc
	if wrapFunc == nil {
		wf = identity
	}
	return h.Div(
		m.first.View(rootUpdateFunc, firstWrapper(m, wf)),
		m.last.View(rootUpdateFunc, lastWrapper(m, wf)),
		h.Button(h.Text("Reset All")).OnClick(rootUpdateFunc, wrapper(m, wf), ResetAll),
		h.Button(h.Text("Randomize All")).OnClick(rootUpdateFunc, wrapper(m, wf), RandomizeAll),
	)
}
示例#4
3
文件: counter.go 项目: gmlewis/go-frp
func (m Model) View(rootUpdateFunc interface{}, wrapFunc WrapFunc) h.HTML {
	style := [][]string{
		{"font-size", "20px"},
		{"font-family", "monospace"},
		{"display", "inline-block"},
		{"width", "50px"},
		{"text-align", "center"},
	}
	return h.Div(
		h.Button(h.Text("-")).OnClick(rootUpdateFunc, wrapper(m, wrapFunc), Decrement),
		h.Div(h.Text(m.String())).Style(style),
		h.Button(h.Text("+")).OnClick(rootUpdateFunc, wrapper(m, wrapFunc), Increment),
	)
}
示例#5
1
func (m Model) View(rootUpdateFunc interface{}, wrapFunc WrapFunc) h.HTML {
	return h.Div(
		m.top.View(rootUpdateFunc, topWrapper(m, wrapFunc)),
		m.bottom.View(rootUpdateFunc, bottomWrapper(m, wrapFunc)),
		h.Button(h.Text("Reset")).OnClick(rootUpdateFunc, wrapper(m, wrapFunc), Reset),
	)
}