vue3-select2-component, filter by first character
P粉921130067
P粉921130067 2023-08-31 10:37:07
0
1
592
<p>I need the filtering option ("Sortizer" in settings works fine) but I can't get the modelValue from the "Input" where I put any symbols. How do I get the first symbol I entered? Only works for event @select, but it is not suitable for this task</p> <pre class="brush:php;toolbar:false;"><Select2 value="modelValue" @input="(e) => modelValue = e.target.value" :settings="select2Settings" /> select2Settings: { sorter: function (results) { return results.filter((item) => item.text.startsWith(modelValue)) } }</pre> <p>I also tried using event @change but it didn't work at all In this demo</p>
P粉921130067
P粉921130067

reply all(1)
P粉466909449

everything is normal!

select2Settings: {
    matcher: function (params, data) {
      if (!params.term)
        return data;
      if (data.text.toLowerCase().startsWith(params.term.toLowerCase()))
        return data;
      else
        return null;
    },
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template