Repository navigation
Conversation
Vue 3 drops the `slot`/`slot-scope` attributes and `vm.$set`; both replacements already work on Vue 2.7, and behaviour is unchanged. Select: the record-link `singleLabel` template moves to `#singleLabel`. Its `v-if` reads the slot props, so it moves inside the slot; when it is false the slot renders nothing and vue-multiselect falls back to its own label, as before. The status `singleLabel` template is removed: Vue 2 keeps only the last template per slot name, so it never rendered. Imagelist: `this.$set(list, i, item)` becomes `list.splice(i, 1, item)`, which is what `$set` does for arrays in Vue 2. The multiselect stub now passes the first selected item to `singleLabel`, like vue-multiselect, so the selected-value label can be tested.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Next step in splitting #3751 towards Vue 3.
Why
The admin still uses two Vue 2 APIs that Vue 3 removes:
slot/slot-scopeattributes, for Select'ssingleLabelslot. They are deprecated and removed in Vue 3, which ignores them silently, so the record link in the selected label would disappear.this.$set, in Imagelist when an image is removed.vm.$setis removed in Vue 3, so removing an image would throw.Why this approach
#singleLabelandArray.prototype.splicealready work on Vue 2.7, so this can land now with no behaviour change.splice(i, 1, item)is what$setdoes for arrays in Vue 2.What changed
#singleLabel. Itsv-ifmoves inside the slot because it reads the slot props. When it is false, vue-multiselect falls back to its own label, as before.singleLabeltemplate is removed. Vue 2 keeps only the last template per slot name, so it never rendered: the selected status shows no dot, before and after.$setbecomessplice.singleLabel, like vue-multiselect does, and two tests cover the selected-value label.Testing
vue3_slot_syntax_and_set_demo.mp4