Skip to content

Commit c5fd475

Browse files
committed
fix: add html case
1 parent 43fcf80 commit c5fd475

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

playground/scenarios/html/_meta.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
mainFile: 'index.html',
3+
ReplOptions: {
4+
theme: 'dark',
5+
},
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js"
4+
}
5+
}

playground/scenarios/html/index.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script type="module">
2+
import { createApp } from 'vue'
3+
4+
// give each todo a unique id
5+
let id = 0
6+
7+
createApp({
8+
data() {
9+
return {
10+
newTodo: '',
11+
todos: [
12+
{ id: id++, text: 'Learn HTML' },
13+
{ id: id++, text: 'Learn JavaScript' },
14+
{ id: id++, text: 'Learn Vue' },
15+
],
16+
}
17+
},
18+
methods: {
19+
addTodo() {
20+
this.todos.push({ id: id++, text: this.newTodo })
21+
this.newTodo = ''
22+
},
23+
removeTodo(todo) {
24+
this.todos = this.todos.filter((t) => t !== todo)
25+
},
26+
},
27+
}).mount('#app')
28+
</script>
29+
30+
<div id="app">
31+
<form @submit.prevent="addTodo">
32+
<input v-model="newTodo" required placeholder="new todo" />
33+
<button>Add Todo</button>
34+
</form>
35+
<ul>
36+
<li v-for="todo in todos" :key="todo.id">
37+
{{ todo.text }}
38+
<button @click="removeTodo(todo)">X</button>
39+
</li>
40+
</ul>
41+
</div>

playground/src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<script setup lang="ts">
1313
import { Repl, useStore } from '../../src'
1414
import ScenarioSelector from './ScenarioSelector.vue'
15-
import MonacoEditor from '../../src/editor/MonacoEditor.vue'
15+
import CodeMirrorEditor from '../../src/editor/CodeMirrorEditor.vue'
1616
// @ts-ignore
1717
import playgroundFiles from 'virtual:playground-files'
1818
import { ref, computed, watchEffect } from 'vue'
@@ -41,7 +41,7 @@ const store = useStore()
4141
4242
const replConfigs = computed(() => ({
4343
store,
44-
editor: MonacoEditor,
44+
editor: CodeMirrorEditor,
4545
editorOptions: {
4646
autoSaveText: '💾',
4747
},

0 commit comments

Comments
 (0)