51 lines
1.1 KiB
Vue
51 lines
1.1 KiB
Vue
<template>
|
||
<div class="app">
|
||
<router-view />
|
||
</div>
|
||
</template>
|
||
<script setup lang="ts">
|
||
import * as echarts from "echarts";
|
||
import { provide, onBeforeMount } from "vue";
|
||
provide("echarts", echarts);
|
||
import { useStore } from "vuex";
|
||
const store = useStore();
|
||
|
||
// 子页面(https://child.com)
|
||
window.addEventListener("message", (event) => {
|
||
console.log("🚀 ~ 传参了:");
|
||
// 2. 获取数据
|
||
const data = event.data;
|
||
if (data.username) {
|
||
// 调用token
|
||
window.sessionStorage.setItem("userInfo", JSON.stringify(data));
|
||
store.dispatch("loginAction", data);
|
||
}
|
||
});
|
||
|
||
// setTimeout(() => {
|
||
console.log("🚀 ~ import.meta.env.VITE_NAME:", import.meta.env.VITE_NAME)
|
||
if (import.meta.env.VITE_NAME == 'wuxi') {
|
||
store.dispatch("loginAction", {
|
||
username: "cdf",
|
||
password: "@#001njcnpqs",
|
||
});
|
||
}
|
||
|
||
// }, 100);
|
||
onBeforeMount(() => {
|
||
window.sessionStorage.setItem("token", "");
|
||
console.log("销毁页面了");
|
||
});
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
@import "@/assets/scss/element.scss";
|
||
|
||
.app {
|
||
width: 100vw;
|
||
height: 100vh;
|
||
background-color: #000;
|
||
overflow: hidden;
|
||
}
|
||
</style>
|