Home  >  Q&A  >  body text

javascript - How to add click event to option in vuejs

The added click event is not called

高洛峰高洛峰2671 days ago982

reply all(3)I'll reply

  • 学习ing

    学习ing2017-06-27 09:21:40

    <select @change="test">
          <option>l</option>
          <option>m</option>
          <option>z</option>
          <option>zs</option>
        </select>

    Is that so?

    reply
    0
  • typecho

    typecho2017-06-27 09:21:40

    The click event is written in <select>

    reply
    0
  • PHP中文网

    PHP中文网2017-06-27 09:21:40

    A terrible thing happened. You actually have the same way of writing as me. My last problem was that there were two exactly the same options, and one was usable and the other was not. So it is not recommended that you use this method.

    1. Use watch to monitor your value. If it changes, call the event to be data-driven.

    2. @change="" is also possible, but there are definitely limitations.

    3. Same as method 1, except that in other places where you use this value, you also use the variables tied to your v-model to be data-driven, but it also has limitations and it is impossible to use it in all scenarios

    reply
    0
  • Cancelreply