提交学习笔记专用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
754 B

  1. <template>
  2. <div class="person">
  3. <h2>当前求和为{{sum}}</h2>
  4. <button @click="increment">点我+1</button>
  5. <button @click="decrement">点我-1</button>
  6. <br>
  7. <img v-for="(dog,index) in dogList" :src="dog" :key="index" >
  8. <button @click="getDog">再来一只狗</button>
  9. </div>
  10. </template>
  11. <script lang="ts">
  12. import {defineComponent} from 'vue'
  13. export default defineComponent({
  14. name:'App',
  15. })
  16. </script>
  17. <script setup lang="ts">
  18. import useSum from '@/hooks/useSum'
  19. import useDog from '@/hooks/useDog'
  20. let {sum,increment,decrement} = useSum()
  21. let {dogList,getDog} = useDog()
  22. </script>
  23. <style scoped>
  24. .person{
  25. width: 200px;
  26. height: 200px;
  27. background-color: palegoldenrod;
  28. }
  29. img{
  30. width: 100%;
  31. height: auto;
  32. }
  33. </style>