回答編集履歴

1

誤字修正

2020/08/17 00:58

投稿

nico25
nico25

スコア830

test CHANGED
@@ -1,41 +1 @@
1
- Vue.js では、匿名関数の中では `this` は、使えません。そのため、以下のように書き換えてください。
2
-
3
-
4
-
5
- ```
6
-
7
- // NG
8
-
9
- export const getters = {
10
-
11
- isSmall: () =>
12
-
13
- this.$vuetify.breakpoint.width < this.$vuetify.breakpoint.thresholds.sm,
14
-
15
- }
16
-
17
- ```
18
-
19
- ```js
20
-
21
- // OK
22
-
23
- export const getters = {
24
-
25
- isSmall() {
1
+ 削除 誤回答のため
26
-
27
- return this.$vuetify.breakpoint.width < this.$vuetify.breakpoint.thresholds.sm
28
-
29
- },
30
-
31
- }
32
-
33
- ```
34
-
35
-
36
-
37
- 正確に言えば使えない訳ではないです。以下の記事の「違い1: thisの指すもの」を、ご確認ください。
38
-
39
-
40
-
41
- * [JavaScript: 通常の関数とアロー関数の違いは「書き方だけ」ではない。異なる性質が10個ほどある。 - Qiita](https://qiita.com/suin/items/a44825d253d023e31e4d#%E9%81%95%E3%81%841-this%E3%81%AE%E6%8C%87%E3%81%99%E3%82%82%E3%81%AE)