D3vugu-components/components/input/text-area.go

30 lines
539 B
Go

package input
import (
"github.com/vugu/vugu"
)
// TextArea is a text or number based input component.
// The HTML input type is determined by the bound data type.
type TextArea struct {
AttrMap vugu.AttrMap
Bind ValueBinder
}
func (c *TextArea) content() string {
if c.Bind != nil {
return c.Bind.StringValue()
}
return ""
}
func (c *TextArea) handleChange(event vugu.DOMEvent) {
val := event.PropString("target", "value")
if c.Bind != nil {
c.Bind.SetStringValue(val) // TODO: Error is omitted, we should show it
}
}