App.vue 1019 B

123456789101112131415161718192021222324252627282930313233
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. console.log('App Launch')
  5. let token = sessionStorage.getItem('token');
  6. token = typeof(token) != 'undefined' && token != null? token : ''
  7. //this.$store.commit('setToken',{access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJqd3Rfd3giLCJleHAiOjE2MjYzMzkxNDEsInN1YiI6IllIIiwiYXVkIjoiZXZlcnkiLCJuYmYiOjE2MjYwNzk5NDEsImlhdCI6MTYyNjA3OTk0MSwianRpIjoxMDAwMSwidWlkIjo1OH0.5m6nZ-F8gJVHu1_5d1l1GSxtKGL8xLWvCJgVCEQQ2QM'})
  8. if((token=='') && this.$router.history.current.path != '/pages/entry/auth'){
  9. }else if(this.$store.state.token){
  10. uni.setTabBarItem({
  11. index: 4,
  12. text: '我的'
  13. })
  14. }
  15. },
  16. onShow: function() {
  17. console.log('App Show')
  18. },
  19. onHide: function() {
  20. console.log('App Hide')
  21. },
  22. }
  23. </script>
  24. <!-- <style>
  25. /*每个页面公共css */
  26. </style> -->
  27. <style lang="scss">
  28. /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  29. @import "uview-ui/index.scss";
  30. </style>