mirror of https://github.com/sveltejs/svelte
parent
fa65f7af60
commit
cc722f8f7a
@ -1,8 +1,8 @@
|
|||||||
[{
|
[{
|
||||||
"message": "Helpers should be pure functions — they do not have access to the component instance and cannot use 'this'. Did you mean to put this in 'methods'?",
|
"message": "Helpers should be pure functions — they do not have access to the component instance and cannot use 'this'. Did you mean to put this in 'methods'?",
|
||||||
"pos": 74,
|
"pos": 95,
|
||||||
"loc": {
|
"loc": {
|
||||||
"line": 7,
|
"line": 7,
|
||||||
"column": 11
|
"column": 4
|
||||||
}
|
}
|
||||||
}]
|
}]
|
@ -1,10 +1,10 @@
|
|||||||
{{foo()}}
|
<button on:click='foo()'>foo</button>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
helpers: {
|
helpers: {
|
||||||
foo () {
|
foo () {
|
||||||
return this.get( 'bar' );
|
this.set({ foo: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
[{
|
||||||
|
"message": "Cannot use this.get(...) — it must be passed into the helper function as an argument",
|
||||||
|
"pos": 74,
|
||||||
|
"loc": {
|
||||||
|
"line": 7,
|
||||||
|
"column": 11
|
||||||
|
}
|
||||||
|
}]
|
@ -0,0 +1,11 @@
|
|||||||
|
{{foo()}}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
helpers: {
|
||||||
|
foo () {
|
||||||
|
return this.get( 'bar' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in new issue