|
2 | 2 | import { ref, computed } from 'vue'
|
3 | 3 | import { lua2js, lua2ast } from '../lua2js.mjs'
|
4 | 4 | import fs from "file-saver";
|
5 |
| -import prettier from "prettier/standalone.js"; |
6 |
| -import parserBabel from "prettier/parser-babel.js"; |
7 | 5 |
|
8 | 6 | const jscodeRef = ref(null)
|
9 | 7 | const showLuaAst = ref(false)
|
@@ -67,7 +65,7 @@ local TestClass = class {
|
67 | 65 | `)
|
68 | 66 | const jscode = computed(() => lua2js(luacode.value))
|
69 | 67 | const luaast = computed(() => lua2ast(luacode.value))
|
70 |
| -const jscode_highlight_html = computed(() => hljs.highlight(jscode.value, {language: 'js'}).value) |
| 68 | +const jscode_highlight_html = computed(() => hljs.highlight(jscode.value, { language: 'js' }).value) |
71 | 69 | function copyJs() {
|
72 | 70 | CopyToClipboard('jscode');
|
73 | 71 | }
|
@@ -103,33 +101,31 @@ function CopyToClipboard(containerid) {
|
103 | 101 | <div>
|
104 | 102 | <div class="row">
|
105 | 103 | <div class="col">
|
106 |
| - <div style="text-align: center;"> |
107 |
| - <h1><a href="https://github.com/xiangnanscu/lua2js">lua2js</a> - transform lua to js literally </h1> |
108 |
| - <div></div> |
109 |
| - <div class="form-check-inline"> |
110 |
| - <label class="form-check-label"> |
111 |
| - <input @input="showLuaAst=!showLuaAst" :value="showLuaAst" type="checkbox" |
112 |
| - class="form-check-input" />show lua ast</label> |
113 |
| - </div> |
114 |
| - <button @click="luacode=''">clear textarea</button> |
115 |
| - <button @click="copyJs">copy js</button> |
116 |
| - <button @click="saveJsAs">save as</button> |
117 |
| - </div> |
118 | 104 | </div>
|
119 | 105 | </div>
|
120 | 106 | <div class="row">
|
121 | 107 | <div class="col">
|
| 108 | + <button @click="luacode = ''">clear textarea</button> |
122 | 109 | <textarea rows="10" style="height:800px" class="form-control" :value="luacode"
|
123 | 110 | @input="luacode = $event.target.value"></textarea>
|
124 | 111 | </div>
|
125 |
| - <div v-if="showLuaAst" class="col"> |
126 |
| - <pre>{{ luaast }}</pre> |
127 |
| - </div> |
128 |
| - <div v-else class="col"> |
129 |
| - <highlightjs language='lua' :code="luacode" /> |
| 112 | + <div class="col"> |
| 113 | + <div class="form-check-inline"> |
| 114 | + <label class="form-check-label"> |
| 115 | + <input @input="showLuaAst = !showLuaAst" :value="showLuaAst" type="checkbox" class="form-check-input" />show |
| 116 | + lua ast</label> |
| 117 | + </div> |
| 118 | + <div v-if="showLuaAst"> |
| 119 | + <pre>{{ luaast }}</pre> |
| 120 | + </div> |
| 121 | + <div v-else> |
| 122 | + <highlightjs language='lua' :code="luacode" /> |
| 123 | + </div> |
130 | 124 | </div>
|
131 | 125 | <div class="col">
|
132 | 126 | <!-- <pre id="jscode2"><code class="language-javascript" v-html="jscode_highlight_html"></code></pre> -->
|
| 127 | + <button @click="copyJs">copy js</button> |
| 128 | + <button @click="saveJsAs">save as</button> |
133 | 129 | <highlightjs id="jscode" language='javascript' :code="jscode" />
|
134 | 130 | </div>
|
135 | 131 | </div>
|
|
0 commit comments