|
@@ -1,8 +1,9 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { computed, unref } from 'vue'
|
|
|
|
|
|
+import { computed, unref, watchEffect } from 'vue'
|
|
import { File, Repl, ReplStore } from '@vue/repl'
|
|
import { File, Repl, ReplStore } from '@vue/repl'
|
|
import mainCode from './main.vue?raw'
|
|
import mainCode from './main.vue?raw'
|
|
-import deptCode from './dept.js?raw'
|
|
|
|
|
|
+import deptCode from './dept?raw'
|
|
|
|
+import { loadKanKanThemeChalkStyle } from './dept'
|
|
import type { SFCOptions } from '@vue/repl'
|
|
import type { SFCOptions } from '@vue/repl'
|
|
|
|
|
|
const sfcOptions: SFCOptions = {
|
|
const sfcOptions: SFCOptions = {
|
|
@@ -30,13 +31,16 @@ const props = defineProps({
|
|
default: () => false,
|
|
default: () => false,
|
|
},
|
|
},
|
|
})
|
|
})
|
|
|
|
+const isDev = computed(() => {
|
|
|
|
+ return import.meta.env.MODE === 'development'
|
|
|
|
+})
|
|
|
|
+const serverLink = computed(() => {
|
|
|
|
+ return unref(isDev) ? '/demoServer' : "https://test.4dkankan.com'"
|
|
|
|
+})
|
|
|
|
|
|
const loadSingleData = computed(() => {
|
|
const loadSingleData = computed(() => {
|
|
const store = {
|
|
const store = {
|
|
- 'App.vue': decodeURIComponent(props.raw),
|
|
|
|
- // files: {
|
|
|
|
- // 'con'
|
|
|
|
- // },
|
|
|
|
|
|
+ 'App.vue': decodeURIComponent(props.raw).replace('#DEMOSEVER#', unref(serverLink)),
|
|
}
|
|
}
|
|
return window.btoa(JSON.stringify(store))
|
|
return window.btoa(JSON.stringify(store))
|
|
})
|
|
})
|
|
@@ -68,6 +72,12 @@ const deptFile = new File('dept.js', deptCode)
|
|
store.addFile(PlaygroundMain)
|
|
store.addFile(PlaygroundMain)
|
|
store.addFile(deptFile)
|
|
store.addFile(deptFile)
|
|
store.state.mainFile = 'PlaygroundMain.vue'
|
|
store.state.mainFile = 'PlaygroundMain.vue'
|
|
|
|
+
|
|
|
|
+watchEffect(async () => {
|
|
|
|
+ if (!unref(props.isRepl)) {
|
|
|
|
+ await loadKanKanThemeChalkStyle()
|
|
|
|
+ }
|
|
|
|
+})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|