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/flush-before-bindings/Nested.html

30 lines
560 B

{{#each things as thing}}
<Visibility bind:isVisible="visibilityMap[thing]">
<p>{{thing}} ({{visibilityMap[thing]}})</p>
</Visibility>
{{/each}}
<script>
import Visibility from './Visibility.html';
import counter from './counter.js';
export default {
data() {
return {
things: ['first thing', 'second thing'],
visibilityMap: {}
};
},
computed: {
visibleThings: (things, visibilityMap) => {
counter.count += 1;
return things.filter(text => visibilityMap[text]);
}
},
components: {
Visibility
}
};
</script>