Subscribe on changes!

Multiple Select Initialization

avatar
Feb 8th 2021

Version

3.0.5

Reproduction link

https://codesandbox.io/s/modest-cannon-7qoku?file=/src/App.vue

Steps to reproduce

  1. Create select with few different options.
  2. Add 'multiple' attr to select.
  3. Add 'selected' attr to few select options.
  4. Just update the page

What is expected?

All selected options are chosen

What is actually happening?

Only last select option is chosen

avatar
Feb 9th 2021

You can use v-model until this gets fixed, https://codesandbox.io/s/angry-sound-ljjte?file=/src/App.vue

avatar
Feb 9th 2021

@HcySunYang Thank you! But unfortunately we need described behavoure. We have pretty big app with tons of legacy code, so then we mount vue into our main wrapper, it breaks all <select multiple > everywhere in the legacy part

avatar
Feb 9th 2021

And we did not have this problem with vue 2

avatar
Feb 10th 2021

The children are patched before props, which is necessary for <select value>, but the opposite is true for <select multiple>. In vue2, we take that as a special case https://github.com/vuejs/vue/blob/dev/src/platforms/web/runtime/node-ops.js#L7-L13, and this PR(https://github.com/vuejs/vue-next/pull/3202) respects this behavior