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

回答編集履歴

2

誤字

2021/07/07 22:44

投稿

tenlife
tenlife

スコア70

answer CHANGED
@@ -1,6 +1,12 @@
1
1
  reactiveの設定をつけるとうまく通りました。
2
2
  vue2で行う場合は@vue/composition-apiでreactiveも読み込む必要があるみたいです。(自分の認識)
3
3
 
4
+ mainでVue.useします。(これ大事そう)
5
+ ```main
6
+ import VueCompositionApi from '@vue/composition-api';
7
+ Vue.use(VueCompositionApi);
8
+ ```
9
+
4
10
  ```vue
5
11
  <script lang="ts">
6
12
  import {defineComponent, ref, reactive } from "@vue/composition-api";

1

誤字

2021/07/07 22:44

投稿

tenlife
tenlife

スコア70

answer CHANGED
@@ -7,13 +7,13 @@
7
7
 
8
8
  export default defineComponent({
9
9
  setup() {
10
- // const title = ref<string>("composition-api");
10
+ const title = ref<string>("composition-api");
11
11
  const state = reactive<{ count: number }>({
12
12
  count: 0
13
13
  });
14
14
 
15
15
  return {
16
- // title,
16
+ title,
17
17
  state
18
18
  }
19
19
  }