Recent

Author Topic: My hello world  (Read 368 times)

lainz

  • Hero Member
  • *****
  • Posts: 3219
    • Lainz
My hello world
« on: May 25, 2019, 02:38:51 pm »
Well, finally I left vue with Pas2js due I can't find the way. But made the same Vue.js demo in no time with regular Pas2js.

Code: Pascal  [Select]
  1. program pas2jsvue;
  2.  
  3. {$mode objfpc}
  4.  
  5. uses
  6.   JS,
  7.   Classes,
  8.   SysUtils,
  9.   StrUtils,
  10.   Web;
  11.  
  12. var
  13.  message: TJSElement;
  14.  button1: TJSElement;
  15. begin
  16.  message := document.getElementById('message');
  17.  button1 := document.getElementById('button1');
  18.  
  19.  button1.addEventListener('click', procedure
  20.   begin
  21.     message.innerText := ReverseString(message.innerText);
  22.   end);
  23. end.

Code: Text  [Select]
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4.   <meta charset="utf-8">
  5.   <title>Pas2JS Vue</title>
  6. </head>
  7. <body>
  8.   <div id="app">
  9.   <p id='message'>Hello World</p>
  10.   <button id='button1'>Reverse Message</button>
  11.   </div>
  12.   <script src="./pas2jsvue.js"></script>
  13.   <script>
  14.   rtl.run();
  15.  
  16.   </script>
  17.  
  18. </body>
  19. </html>    
« Last Edit: May 25, 2019, 03:03:37 pm by Lainz »