App.vue 1019 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <div id="app">
  3. <router-view />
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: "App",
  9. data() {
  10. return {
  11. loginForm: {
  12. username: "fsdd",
  13. password: "123456",
  14. },
  15. };
  16. },
  17. metaInfo() {
  18. return {
  19. title:
  20. this.$store.state.settings.dynamicTitle &&
  21. this.$store.state.settings.title,
  22. titleTemplate: (title) => {
  23. return title
  24. ? `${title} - ${process.env.VUE_APP_TITLE}`
  25. : process.env.VUE_APP_TITLE;
  26. },
  27. };
  28. },
  29. created() {
  30. // 获取当前地址的名字
  31. var url = window.document.location.pathname;
  32. // 获取当前地址之后的目录
  33. var url1 = window.document.location.hash;
  34. if (url === "/admin") {
  35. this.getloing();
  36. }
  37. },
  38. methods: {
  39. getloing() {
  40. this.$store.dispatch("Login", this.loginForm).then(() => {
  41. this.$router.push({ path: "/pt" }).catch(() => {});
  42. window.document.location.pathname='/123'
  43. });
  44. },
  45. },
  46. };
  47. </script>