Vue+Vite项目部署GitHub Pages遇TypeError: _l is not a function及API失败
问题:Vue+Vite项目部署到GitHub Pages后无法加载Nintendo Eshop API数据
问题概述
使用Vue和Vite构建的网站,调用Nintendo-Switch-Eshop API获取游戏数据,开发模式下API请求正常,但部署到GitHub Pages后,API数据无法展示,控制台出现以下错误:
index.e6fd7be5.js:1 TypeError: _l is not a function at Proxy.mounted (GamesView.f6090e0f.js:33:112746) at index.e6fd7be5.js:1:19501 at tt (index.e6fd7be5.js:1:12401) at Ae (index.e6fd7be5.js:1:12479) at Mn.t.__weh.t.__weh (index.e6fd7be5.js:1:19381) at so (index.e6fd7be5.js:1:13772) at oo (index.e6fd7be5.js:1:14079) qi @ index.e6fd7be5.js:1 games:1 Failed to load resource: the server responded with a status of 404 ()
相关Vue代码
<template> <div class="gameView"> <game-card v-for="game in games" :key="game.sku" :img="game.productImage" :name="game.title" :description="game.description" :id="game.sku" :price="game.price" :autor="game.softwareDeveloper" > </game-card> </div> </template> <script> import { getGamesAmerica, getGamesEurope, getGamesJapan, getQueriedGamesAmerica, } from "nintendo-switch-eshop"; import gameCard from "../components/gameView/gameCard.vue"; export default { components: { gameCard }, name: "GamesView", data() { return { games: [], }; }, mounted() { console.log("GamesView mounted"); getQueriedGamesAmerica() .then((games) => { console.log("GamesView getGamesAmerica", games); this.games = games; }) .catch((error) => { console.log("GamesView getGamesAmerica error", error); }); }, methods: { increment() { this.$store.commit("increment"); console.log(this.$store.state.count); }, }, watch: {}, }; </script> <style> @media (min-width: 1024px) { .gameView { min-height: 105vh; display: flex; align-items: center; } } </style>
内容的提问来源于stack exchange,提问作者Ivan Surya Hutomo
相关产品推荐
相关产品推荐

