30 lines
464 B
Go
30 lines
464 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 *string
|
||
|
}
|
||
|
|
||
|
func (c *TextArea) content() string {
|
||
|
if c.Bind != nil {
|
||
|
return *c.Bind
|
||
|
}
|
||
|
|
||
|
return ""
|
||
|
}
|
||
|
|
||
|
func (c *TextArea) handleChange(event vugu.DOMEvent) {
|
||
|
val := event.PropString("target", "value")
|
||
|
|
||
|
if c.Bind != nil {
|
||
|
*c.Bind = val
|
||
|
}
|
||
|
}
|