Documentation ¶
Overview ¶
Package vue is the progressive framework for wasm applications.
Package vue is the progressive framework for wasm applications.
Index ¶
- type Comp
- type Context
- type Option
- func Computed(name string, function interface{}) Option
- func Computeds(functions ...interface{}) Option
- func Data(data interface{}) Option
- func El(el string) Option
- func Method(name string, function interface{}) Option
- func Methods(functions ...interface{}) Option
- func Props(props ...string) Option
- func Sub(element string, sub *Comp) Option
- func Template(tmpl string) Option
- func Watch(field string, function interface{}) Option
- type ViewModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface { Data() interface{} Get(field string) interface{} Set(field string, value interface{}) Go(method string, args ...interface{}) Emit(event string, args ...interface{}) }
Context is received by functions to interact with the component.
type Option ¶
type Option func(*Comp)
Option uses the option pattern for components.
func Computed ¶
Computed is the computed option for components. The given name and function is registered as a computed property for the component. The function is required to accept context and return a value. For example: func(vctx vue.Context) Type
func Computeds ¶
func Computeds(functions ...interface{}) Option
Computeds is the computeds option for components. The given functions are registered as computed properties for the component. The functions are required to accept context and return a value. For example: func(vctx vue.Context) Type
func Data ¶
func Data(data interface{}) Option
Data is the data option for components. This option accepts either a function or a struct. The data function is expected to return a new data value. For example: func() *Type { return &Type{...} } Without a function the data is shared across components. The scope of the data is within the component. Data must be a pointer to be mutable by methods.
func El ¶
El is the element option for components. The root element of a component is query selected from the value, e.g. #app or body.
func Method ¶
Method is the method option for components. The given name and function is registered as a method for the component. The function is required to accept context and allows optional arguments. For example: func(vctx vue.Context) or func(vctx vue.Context, a1 Arg1, ..., ak ArgK)
func Methods ¶
func Methods(functions ...interface{}) Option
Methods is the methods option for components. The given functions are registered as methods for the component. The functions are required to accept context and allows optional arguments. For example: func(vctx vue.Context) or func(vctx vue.Context, a1 Arg1, ..., ak ArgK)
func Template ¶
Template is the template option for components. The template uses the mustache syntax for rendering. The template must have a single root element.
func Watch ¶
Watch is the watch option for components. The given function is registered as a watcher for the data field. All data fields are watchable, e.g. data, props and computed. The function is required to accept context and both the new and old values. For example: func(vctx vue.Context, newVal, oldVal Type)
type ViewModel ¶
type ViewModel struct {
// contains filtered or unexported fields
}
ViewModel is a vue view model, e.g. VM.
func (*ViewModel) Data ¶
func (vm *ViewModel) Data() interface{}
Data returns the data for the component. Props and computed are excluded from data.
func (*ViewModel) Get ¶
Get returns the data field value. Props and computed are included to get. Computed may be calculated as needed.