微信

App.vue 1019B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <div id="app" v-if="showPage">
  3. <router-view ></router-view>
  4. </div>
  5. </template>
  6. <script>
  7. import '../../common/css/reset.css'
  8. import { mapState, createNamespacedHelpers } from 'vuex'
  9. const { mapActions: actions } = createNamespacedHelpers('userCenter')
  10. export default {
  11. name: 'app',
  12. data () {
  13. return {
  14. showPage: false
  15. }
  16. },
  17. components: {},
  18. computed: {
  19. ...mapState({
  20. userInfo: x => x.userCenter.userInfo,
  21. org: x => x.app.orgId
  22. })
  23. },
  24. created () {
  25. console.log('creatde')
  26. if (location.search && this.toolClass.UrlSearch(location.search).code) {
  27. this.code = this.toolClass.UrlSearch(location.search).code
  28. } else {
  29. this.code = null
  30. }
  31. this.getUserInfo({ org: this.org, code: this.code }).then(() => {
  32. this.showPage = true
  33. })
  34. },
  35. methods: {
  36. ...actions(['getUserInfo'])
  37. }
  38. }
  39. </script>
  40. <style>
  41. #app {
  42. width: 100%;
  43. height: 100%;
  44. position: relative;
  45. }
  46. </style>