简体   繁体   English

在ReactiveSearch Vue组件中寻找@valueChange的示例实现

[英]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. 我正在努力在Vue组件中实现@valueChange事件的任何实现。

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 在这里,您可以在第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)
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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