url地址添加到.env文件中
This commit is contained in:
parent
ba85036a42
commit
5292ce8f82
1
frontend/.env.development
Normal file
1
frontend/.env.development
Normal file
@ -0,0 +1 @@
|
|||||||
|
VITE_API_BASE_URL=http://localhost:8443/api
|
||||||
1
frontend/.env.production
Normal file
1
frontend/.env.production
Normal file
@ -0,0 +1 @@
|
|||||||
|
VITE_API_BASE_URL=http://159.75.150.210:8443/api
|
||||||
@ -2,6 +2,7 @@
|
|||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { API_BASE_URL } from './api/base'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@ -37,9 +38,7 @@ const editForm = reactive({
|
|||||||
comments_summary: ''
|
comments_summary: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
// API基础URL
|
// API基础URL(从环境变量导入)
|
||||||
// const API_BASE_URL = 'http://159.75.150.210:8443/api' // 远程服务器
|
|
||||||
const API_BASE_URL = 'http://localhost:8443/api' // 本地服务器
|
|
||||||
|
|
||||||
// 格式化播放量
|
// 格式化播放量
|
||||||
const formatPlayCount = (count) => {
|
const formatPlayCount = (count) => {
|
||||||
|
|||||||
@ -165,9 +165,10 @@
|
|||||||
import { ref, onMounted, computed } from 'vue'
|
import { ref, onMounted, computed } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { API_BASE_URL } from './api/base'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const API_BASE_URL = 'http://localhost:8443/api'
|
// API基础URL(从环境变量导入)
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const applications = ref([])
|
const applications = ref([])
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { API_BASE_URL } from './api/base'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@ -17,8 +18,7 @@ const loading = ref(false)
|
|||||||
const dramaId = route.params.id
|
const dramaId = route.params.id
|
||||||
const fieldType = route.query.type // 'copyright' 或 'manufacturing'
|
const fieldType = route.query.type // 'copyright' 或 'manufacturing'
|
||||||
|
|
||||||
// API基础URL
|
// API基础URL(从环境变量导入)
|
||||||
const API_BASE_URL = 'http://localhost:8443/api'
|
|
||||||
|
|
||||||
// 计算属性
|
// 计算属性
|
||||||
const fieldLabel = computed(() => {
|
const fieldLabel = computed(() => {
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
import { ref, onMounted, nextTick } from 'vue'
|
import { ref, onMounted, nextTick } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { API_BASE_URL } from './api/base'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@ -23,8 +24,7 @@ const dramaData = ref({
|
|||||||
comments_summary: '' // 用户评论总结
|
comments_summary: '' // 用户评论总结
|
||||||
})
|
})
|
||||||
|
|
||||||
// API基础URL
|
// API基础URL(从环境变量导入)
|
||||||
const API_BASE_URL = 'http://localhost:8443/api' // 本地服务器
|
|
||||||
|
|
||||||
// 返回上一页(直接返回首页)
|
// 返回上一页(直接返回首页)
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
|
|||||||
1
frontend/src/api/base.js
Normal file
1
frontend/src/api/base.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
|
||||||
Loading…
x
Reference in New Issue
Block a user