0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
svelte/test/runtime/samples/custom-method/main.html

22 lines
258 B
HTML
Raw Normal View History

2016-11-19 15:17:09 +01:00
<button on:click='add1()'>+1</button>
<p>{{counter}}</p>
<script>
export default {
data: () => ({
counter: 0
}),
methods: {
add1 () {
this.set({ counter: this.get().counter + 1 });
2016-11-19 15:17:09 +01:00
},
foo () {
return 42;
}
}
};
</script>