1 回答
TA贡献1847条经验 获得超7个赞
defineComponent要获得类型推断,您应该使用从 vue 导入来创建组件实例:
<script>
import { PadelGame } from "@/models/padelGame.interface";
import { getPadelPlayers, prepareGames } from "../services/americanoService";
import { PadelPlayer } from "@/models/padelPlayer.interface";
import {defineComponent} from 'vue'
const padelGames: PadelGame[] = [];
export default defineComponent({
data() {
return {
players: getPadelPlayers(),
games: padelGames,
};
},
methods: {
onAddPlayers() {
this.games = prepareGames(this.players as PadelPlayer[]);
},
getPlayerPlaceholder(index: number) {
const playerNumber = Number(index) + 1;
return "Spelare " + playerNumber;
},
},
});
</script>
添加回答
举报