parent
96114b44ab
commit
dfc94db91a
@ -1 +0,0 @@
|
||||
export let api_host = 'http://localhost:5291';
|
@ -535,7 +535,8 @@
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useHead } from "#app";
|
||||
import { useRouter } from "vue-router"; //匯入路徑
|
||||
const { $api_host } = useNuxtApp(); //匯入API host
|
||||
const config = useRuntimeConfig();
|
||||
const $api_host = config.public.apiHost;
|
||||
const router = useRouter(); // 匯入
|
||||
|
||||
useHead({
|
||||
|
@ -533,7 +533,8 @@
|
||||
<script setup>
|
||||
import { useHead } from "#app";
|
||||
import { useRouter } from "vue-router"; //匯入路徑
|
||||
const { $api_host } = useNuxtApp(); //匯入API host
|
||||
const config = useRuntimeConfig();
|
||||
const $api_host = config.public.apiHost;
|
||||
const router = useRouter(); // 匯入
|
||||
|
||||
useHead({
|
||||
|
@ -2,10 +2,9 @@
|
||||
export default defineNuxtConfig({
|
||||
compatibilityDate: '2024-11-01',
|
||||
devtools: { enabled: true },
|
||||
plugins: ['~/plugins/api-host.js'],
|
||||
runtimeConfig: {
|
||||
public: {
|
||||
apiHost: process.env.NUXT_PUBLIC_API_HOST || 'http://localhost:5291',
|
||||
apiHost: 'http://localhost:5291',
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -1,4 +0,0 @@
|
||||
export default defineNuxtPlugin(nuxtApp => {
|
||||
// 定義 api_host 為全局變數
|
||||
nuxtApp.provide('api_host', 'http://localhost:5291');
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user