質問編集履歴
2
問題が発生する最小のコードに変更しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,110 +2,48 @@
|
|
2
2
|
|
3
3
|
エラーログ
|
4
4
|
```log
|
5
|
-
[Vue warn]: Unknown custom element: <
|
5
|
+
[Vue warn]: Unknown custom element: <SKTestButton> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
|
6
6
|
```
|
7
|
-
`
|
7
|
+
`SKHomepage.vue`も`SKTestButton.vue`も`"name"`を指定しているはずなのにDevTool上では`<Anonymous Component>`扱いされてしまうのが原因だと思うのですが、どこが悪いかわかりません。
|
8
8
|
|
9
|
-
|
9
|
+
SKHomepage.vue
|
10
10
|
```vue
|
11
11
|
<template>
|
12
|
-
|
12
|
+
<div>
|
13
|
-
|
13
|
+
<h1>Homepage</h1>
|
14
|
-
<SKGameDota2MatchTeamTable :players="goodPlayers"></SKGameDota2MatchTeamTable>
|
15
|
-
|
14
|
+
<SKTestButton></SKTestButton>
|
16
|
-
<SKGameDota2MatchTeamTable :players="badPlayers"></SKGameDota2MatchTeamTable>
|
17
15
|
</div>
|
18
16
|
</template>
|
19
17
|
|
20
18
|
<script lang="ts">
|
21
|
-
import { Component, Vue } from 'vue-property-decorator';
|
22
|
-
import
|
19
|
+
import Vue from 'vue'
|
23
20
|
|
24
|
-
import
|
21
|
+
import SKTestButton from './SKTestButton.vue'
|
25
22
|
|
26
|
-
import SKGameDota2MatchTeamTable from "./SKGameDota2MatchTeamTable.vue";
|
27
|
-
|
28
|
-
|
23
|
+
export default Vue.extend({
|
29
|
-
match: Dota2Match | null,
|
30
|
-
goodPlayers: Dota2MatchPlayer[],
|
31
|
-
badPlayers: Dota2MatchPlayer[],
|
32
|
-
}
|
33
|
-
|
34
|
-
@Component({
|
35
|
-
name:
|
24
|
+
name: 'sk-homepage',
|
36
25
|
components: {
|
37
|
-
|
26
|
+
'SKTestButton': SKTestButton,
|
38
27
|
},
|
39
|
-
data(): DataType {
|
40
|
-
return {
|
41
|
-
match: null,
|
42
|
-
goodPlayers: [],
|
43
|
-
badPlayers: [],
|
44
|
-
}
|
45
|
-
},
|
46
|
-
mounted() {
|
47
|
-
const matchID = this.$route.params["match_id"];
|
48
|
-
this.axios
|
49
|
-
.get<Dota2Match>("/game/dota2/matches/" + matchID + ".json")
|
50
|
-
.then(response => {
|
51
|
-
this.$data.match = response.data;
|
52
|
-
const players = response.data.players;
|
53
|
-
this.$data.goodPlayers = [
|
54
|
-
players[0],
|
55
|
-
players[1],
|
56
|
-
players[2],
|
57
|
-
players[3],
|
58
|
-
players[4],
|
59
|
-
];
|
60
|
-
this.$data.badPlayers = [
|
61
|
-
players[5],
|
62
|
-
players[6],
|
63
|
-
players[7],
|
64
|
-
players[8],
|
65
|
-
players[9],
|
66
|
-
];
|
67
|
-
});
|
68
|
-
},
|
69
28
|
})
|
70
|
-
export default class SKGameDota2Match extends Vue {};
|
71
29
|
</script>
|
72
30
|
```
|
73
31
|
|
74
|
-
|
32
|
+
SKTestButton.vue
|
75
|
-
```
|
33
|
+
```vue
|
76
34
|
<template>
|
77
|
-
<div>
|
78
|
-
|
35
|
+
<button>Push me!</button>
|
79
|
-
<el-table-column label="Player" prop="persona" width="200" fixed></el-table-column>
|
80
|
-
<el-table-column label="Lv" prop="level" align="center" width="60"></el-table-column>
|
81
|
-
<el-table-column label="K" prop="kills" align="center" width="60"></el-table-column>
|
82
|
-
<el-table-column label="D" prop="deaths" align="center" width="60"></el-table-column>
|
83
|
-
<el-table-column label="A" prop="assists" align="center" width="60"></el-table-column>
|
84
|
-
<el-table-column label="Gold" prop="gold" align="right" width="100"></el-table-column>
|
85
|
-
<el-table-column label="LH" prop="last_hits" align="right" width="80"></el-table-column>
|
86
|
-
<el-table-column label="DN" prop="denies" align="left" width="80"></el-table-column>
|
87
|
-
<el-table-column label="GPM" prop="gold_per_min" align="right" width="80"></el-table-column>
|
88
|
-
<el-table-column label="XPM" prop="xp_per_min" align="right" width="80"></el-table-column>
|
89
|
-
<el-table-column label="HEAL" prop="hero_healing" align="right" width="100"></el-table-column>
|
90
|
-
<el-table-column label="HERO" prop="hero_damage" align="right" width="100"></el-table-column>
|
91
|
-
<el-table-column label="BUILD" prop="tower_damage" align="right" width="100"></el-table-column>
|
92
|
-
</el-table>
|
93
|
-
</div>
|
94
36
|
</template>
|
95
37
|
|
96
38
|
<script lang="ts">
|
97
|
-
import Vue from
|
39
|
+
import Vue from 'vue'
|
98
|
-
|
99
|
-
import { Dota2Match, Dota2MatchPlayer } from "../../../game/dota2/Dota2Match";
|
100
|
-
|
101
40
|
export default Vue.extend({
|
102
|
-
name:
|
41
|
+
'name': 'SKTestButton'
|
103
|
-
props: {
|
104
|
-
"players": {},
|
105
|
-
},
|
106
|
-
})
|
42
|
+
})
|
107
43
|
</script>
|
108
44
|
```
|
109
45
|
|
110
46
|
続報1
|
111
|
-
`Vue.component`を使えば名前ありで登録できました。これを使わず登録するにはどうすればいいでしょう?
|
47
|
+
`Vue.component`を使えば名前ありで登録できました。これを使わず登録するにはどうすればいいでしょう?
|
48
|
+
編集2
|
49
|
+
問題が発生する最小のコードに変更しました。
|
1
続報の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -105,4 +105,7 @@
|
|
105
105
|
},
|
106
106
|
});
|
107
107
|
</script>
|
108
|
-
```
|
108
|
+
```
|
109
|
+
|
110
|
+
続報1
|
111
|
+
`Vue.component`を使えば名前ありで登録できました。これを使わず登録するにはどうすればいいでしょう?
|