12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Vue.js markdown editor example</title>
- <link rel="stylesheet" href="css/style.css">
- <script src="https://unpkg.com/lodash@4.16.0"></script>
-
- <script src="js/vue.js"></script>
- </head>
- <body>
- <div id="app">
- <textarea v-model="input" cols="80" rows="20"></textarea>
- <button v-on:click="send">send</button>
- </div>
- <script>
- new Vue({
- el: '#app',
- data: {
- input: '// rde.writeCmd("set_digital_out(2,True)");\n' +
- '// rde.writeCmd("movej([-1.95,-1.58,-1.16,-1.15,-1.55,1.25], a=1.0, v=0.1)");\n' +
- '//rde.writeCmd("freedrive_mode()");\n'+
- 'def asdf():\n' +
- ' set_digital_out(3, True) \n' +
- ' set_digital_out(4, True) \n' +
- 'end',
- log: null
- },
- created: function() {
- setTimeout(this.update, 1000);
- },
- methods: {
- send: function (event) {
- fetch('/cmd', {method: "POST", body: this.input})
- .then(function(response) {
- return response;
- });
- },
- update: function (event) {
- fetch('/log', {method: "GET"})
- .then(function (value) {
- this.data.log=value;
- })
- }
- }
- })
- </script>
- </body>
- </html>
|