Vuejs model does not work inside scoped slots

Table of contents

First, it seems like you are not supposed to modify passed to a slot (which is kinda weird because it removes lots of possibilities with slots).

That said, if you pass an object and modify its properties, you can (kind of) get around that issue.

Another option is to pass a method that can be used to update the slot prop value (which seems to be the recommended way).

The last option (which seems to be an intentional side effect), is that if you pass the prop to 1 slot, then pass it again into a nested child slot, then the modified data is updated correctly as well.

Share