App.vue 768 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <div id="app">
  3. <router-view />
  4. </div>
  5. </template>
  6. <script>
  7. import { createNamespacedHelpers } from 'vuex';
  8. import _ from 'lodash';
  9. const { mapActions } = createNamespacedHelpers('login');
  10. export default {
  11. name: 'App',
  12. components: {},
  13. created() {
  14. this.toLogin();
  15. },
  16. methods: {
  17. ...mapActions(['login']),
  18. async toLogin() {
  19. let object = { mobile: '13089419811', passwd: '12345678' };
  20. let res = await this.login(object);
  21. if (_.isBoolean(res)) console.log('登陆成功');
  22. else this.$message.warning(res.errmsg);
  23. },
  24. },
  25. };
  26. </script>
  27. <style lang="less">
  28. html {
  29. overflow: hidden;
  30. body {
  31. margin: 0;
  32. padding: 0;
  33. }
  34. margin: 0;
  35. padding: 0;
  36. p {
  37. margin: 0;
  38. padding: 0;
  39. }
  40. }
  41. </style>