We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.7.15
codesandbox.io
click button
has reactivity
no reactivity
The text was updated successfully, but these errors were encountered:
The proper way to update the array is with $set() or splice() (https://v2.vuejs.org/v2/guide/reactivity.html#For-Arrays). Note you will see the same issue with <template #default>, this is because with the template you will need to call $forceUpdate() on the child component Swatch as $forceUpdate() doesn't touch children:
$set()
splice()
<template #default>
$forceUpdate()
<template> <div id="app"> <button @click="f">{{ x }}</button> <!-- default slot OK --> <Swatches> {{ x }} </Swatches> <!-- named slot BAD --> <Swatches ref="sw1"> <template #qqqqqq>{{ x }} </template> </Swatches> </div> </template> <script> import Swatches from "./components/Swatches"; export default { components: { Swatches, }, data: () => ({ x: [1], }), methods: { async f() { // this.$set(this.x, 0, this.x[0] + 1) this.x[0]++ this.$forceUpdate() this.$refs.sw1.$forceUpdate() }, }, }; </script>
Sorry, something went wrong.
I recommend changing the documentation, with the caveat that forceUpdate only works with unnamed slots
No branches or pull requests
Version
2.7.15
Reproduction link
codesandbox.io
Steps to reproduce
click button
What is expected?
has reactivity
What is actually happening?
no reactivity
The text was updated successfully, but these errors were encountered: