@@ -6,9 +6,9 @@ export default defineComponent({
setup() {
const projectStore = useProjectStore();
onMounted(() => {
- projectStore.setLastAllEnergy();
+
- //这两个请求不能写在这里 router.beforeEach 发生在后面,其中有 改变projectId的方法
+ //这两个请求不能写在这里 因为router.beforeEach 发生在后面,获取不到projectId
// projectStore.setWeather();
// projectStore.setProjectObj();
});
@@ -58,6 +58,7 @@ export default defineComponent({
widthBase: "0%",
compareBase: "0%",
+ //因为用到 所以执行
const lastAllComputed = computed(() => {
const lastAllEnergy = projectStore.lastAllEnergy;
//debugger;
@@ -43,7 +43,7 @@ router.beforeEach(async (to, from, next) => {
await projectStore.setWeather();
await projectStore.setProjectObj();
-
+ await projectStore.setLastAllEnergy();
next();
// if (to.path.indexOf("login") == -1) {
// return { name: "login" };