// App.vue <template> <view class="app-container"> </view> </template> <script> import tarbar from './components/tarbar/tarbar.vue'; import tarbar_home from "@/components/tarbar_home/tarbar_home.vue"; import tarbar_user from "@/components/tarbar_user/tarbar_user.vue"; import tarbar_community from "@/components/tarbar_community/tarbar_community.vue"; import tarbar_puppy_chat from "@/components/tarbar_puppy_chat/tarbar_puppy_chat.vue"; import my_pop_up from './components/my_pop_up/my_pop_up.vue'; export default { globalData: { // 定义后端数据库地址信息 fit_journey_basic_address: 'http://127.0.0.1:8081', fit_journey_community_address: 'http://localhost:8082', fit_journey_ai_address: 'http://localhost:8083', fit_journey_login_address: 'http://localhost:8084', fit_journey_recipe_address: 'http://localhost:8085', fit_journey_exercise_address: 'http://localhost:8086', // TODO: 后期需要把 token 更换成从 localStorage 中获取 token: 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxODUxOTgwMTI1O' + 'TYxMjMyMzg1IiwiaXNzIjoiZml0am91cm5leSIsInVzZXJuY' + 'W1lOiI6InRlc3QiLCJyb2xlczoiOiJ1c2VyIiwiaWQ6IjoxODUxOTgwM' + 'TI1OTYxMjMyMzg1LCJpYXQiOjE3MzA1NDEzMTksImV4cCI6MzE3' + 'MDkwNTQxMzE5fQ.tdP-uBa-oKVJjGJlN70tzxXCa4usXOev6xf_fgZhWD4' }, components: { tarbar, my_pop_up // JS 变量名中不能有‘-’ }, onLaunch: function() { console.log('App Launch'); // 你可以在这里执行初始化逻辑,比如检查用户状态 }, onShow: function() { console.log('App Show'); // 更新应用状态,比如获取最新数据 }, onHide: function() { console.log('App Hide'); // 清理工作,比如保存数据 } }; </script> <style> /* 你的样式 */ .app-container { position: relative; /* 确保容器能够正确定位子元素 */ height: 100vh; /* 确保应用占满整个视口 */ } /* 其他全局样式 */ </style>