Files
bigscreenWeb/src/App.vue
2025-10-11 09:54:24 +08:00

51 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>