質問編集履歴

1

ソースコードをテキストで記載しました

2023/01/18 04:59

投稿

hayashida
hayashida

スコア4

test CHANGED
File without changes
test CHANGED
@@ -16,8 +16,39 @@
16
16
  そのようにしています。
17
17
 
18
18
  ### 該当のソースコード
19
+ ```ChildComponent.vue
20
+ <template>
19
- ChildComponent.vue![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2023-01-18/f6558659-7fc0-44de-b344-a54ee070322e.png)
21
+ <div v-if="mode != ''">{{ mode }}モードです</div>
22
+ </template>
20
23
 
24
+ <script setup lang="ts">
25
+ import { defineProps } from "vue";
26
+
27
+ const props = defineProps<{
28
+ mode: {
29
+ type: "" | "追加" | "編集" | "照会";
30
+ default: "";
31
+ };
32
+ }>();
33
+ </script>
34
+ ```
35
+
36
+ ChildComponent.vueで発生しているエラー
37
+ ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2023-01-18/f6558659-7fc0-44de-b344-a54ee070322e.png)
38
+
21
- ParentComponent.vue
39
+ ```ParentComponent.vue
40
+ <template>
41
+ <ChildComponent :mode="mode" />
42
+ </template>
43
+
44
+ <script setup lang="ts">
45
+ import { Ref, ref } from "vue";
46
+ import ChildComponent from "../components/ChildComponent.vue";
47
+
48
+ const mode: Ref<"" | "追加" | "編集" | "照会"> = ref("");
49
+ </script>
50
+ ```
51
+
52
+ ParentComponent.vueで発生しているエラー
22
53
  ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2023-01-18/680ddf8a-2c6a-4482-a785-b407902d2be9.png)
23
54