teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

br

2021/04/05 05:06

投稿

progleader
progleader

スコア19

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,7 @@
1
1
  ##### 困っていること
2
2
 
3
- [async-with-custom-template(buefy)](https://buefy.org/documentation/autocomplete/#async-with-custom-template)のts実装を試みてますが、コールバック関数内の`this`をVueComponentと明示できず、以下のエラーが消せません
3
+ [async-with-custom-template(buefy)](https://buefy.org/documentation/autocomplete/#async-with-custom-template)のts実装を試みてますが、
4
+ コールバック関数内の`this`をVueComponentと明示できず、以下のエラーが消せません
4
5
  ```
5
6
  // TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
6
7
  ```

3

補足

2021/04/05 05:06

投稿

progleader
progleader

スコア19

title CHANGED
File without changes
body CHANGED
@@ -14,10 +14,11 @@
14
14
 
15
15
 
16
16
  ```vue
17
+ // https://buefy.org/documentation/autocomplete/#async-with-custom-template のサンプルを簡略化したものになります。
17
18
  <template>
18
19
  <b-autocomplete
19
20
  :data="data"
20
- placeholder="e.g. Google"
21
+ placeholder="this is placeholder"
21
22
  :loading="isFetching"
22
23
  field="title"
23
24
  @typing="getAsyncData"

2

version bottom

2021/04/05 05:06

投稿

progleader
progleader

スコア19

title CHANGED
File without changes
body CHANGED
@@ -1,9 +1,3 @@
1
- ##### バージョン
2
-
3
- - vue 2.6.12
4
- - nuxt 2.14.5
5
-
6
-
7
1
  ##### 困っていること
8
2
 
9
3
  [async-with-custom-template(buefy)](https://buefy.org/documentation/autocomplete/#async-with-custom-template)のts実装を試みてますが、コールバック関数内の`this`をVueComponentと明示できず、以下のエラーが消せません
@@ -58,4 +52,10 @@
58
52
 
59
53
  ```
60
54
 
55
+ ##### バージョン
56
+
57
+ - vue 2.6.12
58
+ - nuxt 2.14.5
59
+
60
+
61
61
  よろしくお願いします。

1

simply source code

2021/04/05 05:04

投稿

progleader
progleader

スコア19

title CHANGED
File without changes
body CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  [async-with-custom-template(buefy)](https://buefy.org/documentation/autocomplete/#async-with-custom-template)のts実装を試みてますが、コールバック関数内の`this`をVueComponentと明示できず、以下のエラーが消せません
10
10
  ```
11
- // TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
11
+ // TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
12
12
  ```
13
13
 
14
14
  [不定なthisをはっきりさせる](https://book.yyts.org/features/function#nathiswohakkirisaseru)などを参考にしたものの、
@@ -45,13 +45,10 @@
45
45
  },
46
46
  methods: {
47
47
  getAsyncData: debounce(function(name) {
48
+ //-----//
48
- // VueComponent{...} であることを確認
49
+ console.log(this); // VueComponent{...} であることを確認
49
- console.log(this);
50
- // TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
50
+ this.isFetching;  // TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
51
- this.isFetching;
52
-
53
- // api process below...
51
+ //-----//
54
- // ...
55
52
  }, 500)
56
53
  }
57
54
  });