Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b7ee573

Browse files
committed
refine Option.AddMethod
1 parent a21f045 commit b7ee573

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎option.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ func (c *Option) SetDataWithMethods(structPtr interface{}) *Option {
199199

200200
// AddMethod adds new method `name` to VueJS intance or component
201201
// using mixins thus will never conflict with Option.SetDataWithMethods
202-
func (o *Option) AddMethod(name string, fn func(vm *ViewModel)) *Option {
202+
func (o *Option) AddMethod(name string, fn func(vm *ViewModel, args []*js.Object)) *Option {
203203
return o.addMixin("methods", js.M{
204204
name: js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
205205
vm := newViewModel(this)
206-
fn(vm)
206+
fn(vm, arguments)
207207
return nil
208208
}),
209209
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /