1234567891011121314151617181920212223242526272829303132 |
- import { ref } from 'vue';
- import { onLoad } from '@dcloudio/uni-app';
- import { useUserStore } from '@/common/stores/user';
- const userStore = useUserStore();
- export function useGlobalShare() {
- const isLogin = () => {
- if(uni.getStorageSync('token')){
- return true
- }else {
- uni.showModal({
- title:'温馨提示',
- content:'当前功能需要登录后使用,是否登录?',
- success: (res) => {
- if(res.confirm){
- userStore.openLoginModal();
- }else{
- return false
- }
- }
- })
- }
- }
-
- onLoad(() => {
- console.log('--- Composable onLoad 触发 (仅页面) ---');
- });
-
- return {
- isLogin
- };
- }
|