You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/set-in-onstate-dedupes-renders/main.html

25 lines
323 B

<Widget foo='{{foo}}' bar='{{bar}}'/>
<script>
import Widget from './Widget.html';
export default {
data () {
return {
foo: { x: 1 },
bar: { x: 1 }
}
},
onstate({ changed, current }) {
if (changed.foo) {
this.set({ bar: current.foo });
}
},
components: {
Widget
}
};
</script>