test.html 794 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>Vue3快速入门</title>
  7. <style>
  8. #app div {
  9. display: none
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <div id="app">
  15. <div :style="{'display':'block'}">
  16. {{text}}
  17. </div>
  18. </div>
  19. <script src="https://cdn.staticfile.org/vue/3.0.5/vue.global.js"></script>
  20. <script>
  21. const {ref, createApp ,onMounted} = Vue
  22. const app = {
  23. setup() {
  24. const text = ref(0);
  25. function aa(){
  26. text.value=text.value+1
  27. }
  28. onMounted(() => {
  29. aa()
  30. });
  31. return {
  32. text,
  33. }
  34. }
  35. }
  36. createApp(app).mount('#app')
  37. </script>
  38. </body>
  39. </html>