Skip to content

Commit

Permalink
fix:修复环境变量读取不到问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jinloser committed Feb 2, 2024
1 parent f5a3636 commit 96da1f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
* 读取配置文件
*/
export function readConfig() {
const getConfigPath = path.join(import.meta.env.EgVuePath, 'config.conf');
const getConfigPath = path.join((window as any).EgVuePath, 'config.conf');
const data = fs.readFileSync(path.resolve(getConfigPath), {
encoding: 'utf8',
flag: 'r',
Expand Down
6 changes: 4 additions & 2 deletions src/views/vueui/video/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<script lang="ts" setup>
import { ipcApiRoute } from '@/utils/ipcMainApi';
import { ipc } from '@/utils/ipcRenderer';
import { reactive, toRaw } from 'vue';
import { onMounted, reactive, toRaw } from 'vue';
import Player from 'xgplayer';
//西瓜视频文档https://v2.h5player.bytedance.com/gettingStarted/#%E5%AE%89%E8%A3%85
import { readConfig } from '@/utils/getConfig';
Expand Down Expand Up @@ -60,7 +60,9 @@ const states = reactive({
const init = () => {
states.p = new Player(toRaw(states.op));
};
init();
onMounted(() => {
init();
});
//选择本地文件
const selectFile = async () => {
var { baseURL } = await readConfig();
Expand Down

0 comments on commit 96da1f3

Please sign in to comment.