4.vue方法使用.html 858 B

12345678910111213141516171819202122232425262728293031
  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>Document</title>
  7. </head>
  8. <body>
  9. <div id="app"></div>
  10. <script src="../vue.js"></script>
  11. <script>
  12. var app = new Vue({
  13. el:"#app",
  14. data:{},
  15. // 方法
  16. methods: {
  17. formData() {
  18. var data = new Date();
  19. var year = data.getFullYear();
  20. var mouth = data.getMonth() + 1;
  21. var day = data.getDay();
  22. var hour = data.getHours();
  23. var minutes = data.getMinutes();
  24. var seconds = data.getSeconds();
  25. var time =
  26. }
  27. },
  28. })
  29. </script>
  30. </body>
  31. </html>