forked from lczmx/MemoryCard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
<template> | ||
<router-view /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from "vue"; | ||
import { useStore } from "vuex"; | ||
export default defineComponent({ | ||
name: "App", | ||
setup() { | ||
// 动态设置后端host | ||
/* | ||
2.window.location.protocol(协议) | ||
结果:http | ||
4.window.location.hostname(域名) | ||
*/ | ||
const protocol = window.location.protocol; | ||
const hostname = window.location.hostname; | ||
const store = useStore(); | ||
store.commit( | ||
"setServiceHost", | ||
`${protocol}//${hostname}` | ||
); | ||
console.log("App ") | ||
return { | ||
// 返回的数据 | ||
}; | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters