Closed itstmyi closed 4 years ago
If the component has no event , how can I get its value ?
If you do something like <input type="text" .value="c.TextValue" @change="c.TextValue = event.PropString("target", "value")"/>
- assuming TextValue is declared on your component struct, like so:
type MyComponent struct {
TextValue string `vugu:"data"`
}
The field TextValue
should stay updated whenever the DOM text input element is changed and you can just use c.TextField
And how can I pass the component value to its root(parent) component ?
For this I think we still need another feature which is "component to component events" - not yet implemented. I will also try to hit this as soon as possible. #7
Thanks for the answer .
The sample (wasm-test-suite/test-003-prop) is very helpful . A child component can let me get its value by
event.PropString("target", "value") in the child component event's code .
If the component has no event , how can I get its value ? And how can I pass the component value to its root(parent) component ?
Thanks for any information .