index.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Vue.js markdown editor example</title>
  6. <link rel="stylesheet" href="css/style.css">
  7. <script src="https://unpkg.com/lodash@4.16.0"></script>
  8. <!-- Delete ".min" for console warnings in development -->
  9. <script src="js/vue.js"></script>
  10. </head>
  11. <body>
  12. <div id="app">
  13. <textarea v-model="input" cols="80" rows="20"></textarea>
  14. <button v-on:click="send">send</button>
  15. <div v-html="compiledMarkdown"></div>
  16. </div>
  17. <script>
  18. new Vue({
  19. el: '#app',
  20. data: {
  21. input: '// rde.writeCmd("set_digital_out(2,True)");\n' +
  22. '// rde.writeCmd("movej([-1.95,-1.58,-1.16,-1.15,-1.55,1.25], a=1.0, v=0.1)");\n' +
  23. '//rde.writeCmd("freedrive_mode()");\n'
  24. },
  25. methods: {
  26. send: function (event) {
  27. fetch('/cmd', {method: "POST", body: this.input})
  28. .then(function(response) {
  29. return response;
  30. });
  31. },
  32. update: _.debounce(function (e) {
  33. this.input = e.target.value
  34. }, 300)
  35. }
  36. })
  37. </script>
  38. </body>
  39. </html>