Vue-select: @change not working

Created on 28 May 2018  路  7Comments  路  Source: sagalbot/vue-select

"vue": "^2.5.16",
"vue-select": "^2.4.0",

<script lang='coffee'>
    Vue = require 'vue/dist/vue.js'
    setParams = Vue.component 'set-params',
        props: 
            params:
                type: Array
                required: true

        methods:
            getOptions: (srv) ->
                console.log('WTF')
                @$emit('get-option', srv)
    module.exports = setParams
</script>
<template>
    <div class='accordion__step step v-step'>
        <div class='step__selects'>
            <div class='v-step__select' v-for='select in params'>
                <v-select v-on:change='getOptions(select.get)' class='v-step__v-select' v-if='select.options.length === 0' label='text' :placeholder='select.placeholder' :disabled='true'></v-select>
                <v-select v-on:change='getOptions(select.get)' class='v-step__v-select' v-else label='text' :placeholder='select.placeholder' :options='select.options'></v-select>
            </div>
        </div>
    </div>
</template>

console log and emitter not worked. Also I tried v-on:change @select, @selected.
event starts working after @input. I didnt find any info about event API, only prop function "onChange".
pls, add some info about event API

Most helpful comment

@cacciatc I tried to use :on-change instead @input and when i render selects and try to set option, browser tab stopped responsing, it seems like infinite iteration, but i cant test - context menu and hotkey for opening console not responsing too.
So i stay to use @input =)

All 7 comments

got the same issue;

the problem with @input is that its triggered on page load and not only when the value is changed. In my case this causes an unnecessary rest api request. So I am also looking for an working change event to hook into

@WebKieth does using :on-change="getOptions" work for you?

@cacciatc I tried to use :on-change instead @input and when i render selects and try to set option, browser tab stopped responsing, it seems like infinite iteration, but i cant test - context menu and hotkey for opening console not responsing too.
So i stay to use @input =)

same issue here, @input does the job for me and saved me, thanks!

@input triggers whenver the value changes.
It'd be convenient to have a @change event that only triggers when the value changes because of user interaction.

The docs actually mention an event like that, but It doesn't work for me.

/**
 * Contains the currently selected value. Very similar to a
 * `value` attribute on an <input>. You can listen for changes
 * using 'change' event using v-on
 * @type {Object||String||null}
 */
value: {
    default: null
},

This behaviour is inconsistent with pretty much everything else unfortunately... see #526 #504 as well

@input, @change, v-on: change are not working but v-on: click is working when I use datetimepicker can anyone help me to solve on change event in vue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xuwenhao picture xuwenhao  路  3Comments

FrozenIce0617 picture FrozenIce0617  路  3Comments

theseawolves picture theseawolves  路  4Comments

gilles6 picture gilles6  路  3Comments

manjunath-coachthem picture manjunath-coachthem  路  3Comments