1👍
✅
You should create composable:
system.js
export function useSystem() {
const loginStatus = ref(false);
return {
loginStatus
}
}
App.vue
<template>
<div v-if="loginStatus"> ...
</template>
<script>
import { useSystem } from "./system.js";
export default {
setup() {
init();
const { loginStatus } = useSystem();
watch(loginStatus, (currentValue) => {
...
});
return {
loginStatus
};
},
};
</script>
Source:stackexchange.com