HelloWorld.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <script setup lang="ts">
  2. import { ref,onMounted } from 'vue'
  3. import { getUserInfo } from '@/apis/user'
  4. defineProps<{ msg: string }>()
  5. const count = ref(0)
  6. async function getUser() {
  7. const res = await getUserInfo({
  8. username: 'admin',
  9. password: '123456'
  10. }).catch(err=>{
  11. console.log(err)
  12. })
  13. console.log(res)
  14. }
  15. onMounted(()=>{
  16. getUser()
  17. })
  18. </script>
  19. <template>
  20. <h1>{{ msg }}</h1>
  21. <div class="card">
  22. <button type="button" @click="count++">count is {{ count }}</button>
  23. <p>
  24. Edit
  25. <code>components/HelloWorld.vue</code> to test HMR
  26. </p>
  27. </div>
  28. <p>
  29. Check out
  30. <a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
  31. >create-vue</a
  32. >, the official Vue + Vite starter
  33. </p>
  34. <p>
  35. Learn more about IDE Support for Vue in the
  36. <a
  37. href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
  38. target="_blank"
  39. >Vue Docs Scaling up Guide</a
  40. >.
  41. </p>
  42. <p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
  43. </template>
  44. <style scoped>
  45. .read-the-docs {
  46. color: #888;
  47. }
  48. </style>