简体   繁体   中英

Looking for an example implementation of @valueChange in a ReactiveSearch Vue component

I am struggling to get any implementation of the @valueChange event working in a Vue component.

I have added it to one of the 'official' tutorials here, but I only get errors.

All I want is to log/alert a message when the selected value from search changes.

Here you can see me trying to add the event, on line 24: https://codesandbox.io/s/4z4vy9zpw

Thanks!

Try this

@valueChange="
  (function(value) {
    this.console.log('current value:', value)
  })($event)
"

Or

// template

@valueChange="handleValue"

// script

methods: {
  ...
  handleValue (value) {
    console.log('current value:', value)
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM