mirror of https://github.com/sveltejs/svelte
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.
25 lines
484 B
25 lines
484 B
6 years ago
|
<script>
|
||
5 years ago
|
// `current` is updated whenever the prop value changes...
|
||
|
export let current;
|
||
6 years ago
|
|
||
5 years ago
|
// ...but `initial` is fixed upon initialisation
|
||
|
const initial = current;
|
||
6 years ago
|
</script>
|
||
|
|
||
5 years ago
|
<p>
|
||
|
<span style="background-color: {initial}">initial</span>
|
||
|
<span style="background-color: {current}">current</span>
|
||
|
</p>
|
||
|
|
||
|
<style>
|
||
|
span {
|
||
|
display: inline-block;
|
||
|
padding: 0.2em 0.5em;
|
||
|
margin: 0 0.2em 0.2em 0;
|
||
|
width: 4em;
|
||
|
text-align: center;
|
||
|
border-radius: 0.2em;
|
||
|
color: white;
|
||
|
}
|
||
1 year ago
|
</style>
|