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.
21 lines
343 B
21 lines
343 B
6 years ago
|
<h1 use:insert="display ? `Hello ${target}` : ''"></h1>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
actions: {
|
||
|
insert(node, text) {
|
||
|
|
||
|
function onClick() {
|
||
|
node.textContent = text;
|
||
|
}
|
||
|
node.addEventListener('click', onClick);
|
||
|
|
||
|
return {
|
||
|
destroy() {
|
||
|
node.removeEventListener('click', onClick);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|