Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass params to method? #46

Open
filipigustavo opened this issue Jul 3, 2019 · 1 comment
Open

How to pass params to method? #46

filipigustavo opened this issue Jul 3, 2019 · 1 comment

Comments

@filipigustavo
Copy link

Hi, how to pass some params to my method?
Something like this:

timers: {
foo: {time: 1000, params: {msg: 'my msg!'}}
},
methods: {
foo(msg = null) {
if (msg) console.log(msg)
else console.log('default msg')
}
}

@masongzhi
Copy link
Contributor

why did you set params in timers, you can set in the methods with vue data

{
  timers: {
    foo: {time: 1000}
  },
  data() {
    return {
      msg: 'my msg!'
    }
  },
  methods: {
    foo() {
      if (this.msg) console.log(this.msg)
      else console.log('default msg')
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants