Skip to content

Commit

Permalink
style: 更新演练场
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyh2001 committed Dec 1, 2023
1 parent bc69c01 commit 2170847
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 68 deletions.
56 changes: 0 additions & 56 deletions packages/fighting-playground/src/App copy.vue

This file was deleted.

3 changes: 1 addition & 2 deletions packages/fighting-playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

<template>
<header-vue />
<!-- <repl :store="store" show-compile-output :editor="CodeMirror" /> -->
<repl :editor="CodeMirror" />
<repl :store="store" show-compile-output :editor="CodeMirror" />
</template>

<style lang="scss">
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-playground/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createApp } from 'vue'
import App from './App.vue'

// console.clear = (): string => ''
console.clear = (): string => ''

createApp(App).mount('#app')
16 changes: 7 additions & 9 deletions packages/fighting-playground/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
fightingImports,
publicPath
} from '../utils/code'
import type { Store, SFCOptions, StoreState, OutputModes } from '@vue/repl'
import type { Store, SFCOptions, StoreState, OutputModes, StoreOptions } from '@vue/repl'

export class ReplStore {
state: StoreState
Expand All @@ -24,15 +24,10 @@ export class ReplStore {

constructor ({
serializedState = '',
defaultVueRuntimeURL = `https://unpkg.com/@vue/runtime-dom@${version}/dist/runtime-dom.esm-browser.js`,
defaultVueRuntimeURL = `https://cdn.jsdelivr.net/npm/@vue/runtime-dom@${version}/dist/runtime-dom.esm-browser.js`,
showOutput = false,
outputMode = 'preview'
}: {
serializedState?: string
showOutput?: boolean
outputMode?: OutputModes | string
defaultVueRuntimeURL?: string
}) {
}: StoreOptions = {}) {
let files: StoreState['files'] = {}

if (serializedState) {
Expand All @@ -51,6 +46,7 @@ export class ReplStore {
this.initialOutputMode = outputMode as OutputModes

let mainFile: string = defaultMainFile

if (!files[mainFile]) {
mainFile = Object.keys(files)[0]
}
Expand All @@ -65,9 +61,11 @@ export class ReplStore {

this.initImportMap()

/** 注入 Fighting Design */
// 注入 Fighting Design
this.state.files[fightingPlugin] = new File(fightingPlugin, fightingPluginCode)

console.log(this.state)

watchEffect(() => compileFile(this as unknown as Store, this.state.activeFile))

for (const file in this.state.files) {
Expand Down

0 comments on commit 2170847

Please sign in to comment.