HelloWorld.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <h1>{{ msg }}</h1>
  3. <p>
  4. Recommended IDE setup:
  5. <a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
  6. +
  7. <a
  8. href="https://marketplace.visualstudio.com/items?itemName=octref.vetur"
  9. target="_blank"
  10. >Vetur</a
  11. >
  12. or
  13. <a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
  14. (if using
  15. <code>&lt;script setup&gt;</code>)
  16. </p>
  17. <p>See <code>README.md</code> for more information.</p>
  18. <p>
  19. <a href="https://vitejs.dev/guide/features.html" target="_blank"
  20. >Vite Docs</a
  21. >
  22. |
  23. <a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
  24. </p>
  25. <button @click="count++">count is: {{ count }}</button>
  26. <p>
  27. Edit
  28. <code>components/HelloWorld.vue</code> to test hot module replacement.
  29. </p>
  30. </template>
  31. <script lang="ts">
  32. import { ref, defineComponent } from "vue";
  33. export default defineComponent({
  34. name: "HelloWorld",
  35. props: {
  36. msg: {
  37. type: String,
  38. required: true,
  39. },
  40. },
  41. setup: () => {
  42. const count = ref(0);
  43. return { count };
  44. },
  45. });
  46. </script>
  47. <style scoped>
  48. a {
  49. color: #42b983;
  50. }
  51. label {
  52. margin: 0 0.5em;
  53. font-weight: bold;
  54. }
  55. code {
  56. background-color: #eee;
  57. padding: 2px 4px;
  58. border-radius: 4px;
  59. color: #304455;
  60. }
  61. </style>