【问题标题】:Looking for an example implementation of @valueChange in a ReactiveSearch Vue component在 ReactiveSearch Vue 组件中寻找 @valueChange 的示例实现
【发布时间】:2019-05-01 18:29:40
【问题描述】:

我正在努力让 @valueChange 事件的任何实现在 Vue 组件中工作。

我已将它添加到此处的“官方”教程之一,但我只收到错误。

我只想在从搜索中选择的值发生变化时记录/提醒一条消息。

在这里,您可以看到我在第 24 行尝试添加事件: https://codesandbox.io/s/4z4vy9zpw

谢谢!

【问题讨论】:

    标签: vue.js reactivesearch


    【解决方案1】:

    试试这个

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

    或者

    // template
    
    @valueChange="handleValue"
    
    // script
    
    methods: {
      ...
      handleValue (value) {
        console.log('current value:', value)
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-07
      • 1970-01-01
      • 2019-03-07
      • 1970-01-01
      • 2017-02-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多