update
This commit is contained in:
@@ -7,6 +7,7 @@ import { analyse, analyzeError, showAnalyse } from "../composables/analyse"
|
|||||||
import {
|
import {
|
||||||
clearInput,
|
clearInput,
|
||||||
code,
|
code,
|
||||||
|
debug,
|
||||||
input,
|
input,
|
||||||
output,
|
output,
|
||||||
reset,
|
reset,
|
||||||
@@ -22,6 +23,9 @@ function copy() {
|
|||||||
copyTextToClipboard(code.value)
|
copyTextToClipboard(code.value)
|
||||||
message.success("已经复制好了")
|
message.success("已经复制好了")
|
||||||
}
|
}
|
||||||
|
function handleDebug() {
|
||||||
|
debug.value = true
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -36,6 +40,14 @@ function copy() {
|
|||||||
:language="code.language"
|
:language="code.language"
|
||||||
>
|
>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
|
<n-button
|
||||||
|
quaternary
|
||||||
|
type="error"
|
||||||
|
v-if="code.value && code.language === 'python'"
|
||||||
|
@click="handleDebug"
|
||||||
|
>
|
||||||
|
调试
|
||||||
|
</n-button>
|
||||||
<n-button quaternary type="primary" @click="copy">复制</n-button>
|
<n-button quaternary type="primary" @click="copy">复制</n-button>
|
||||||
<n-button quaternary @click="reset">清空</n-button>
|
<n-button quaternary @click="reset">清空</n-button>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,12 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<iframe width="100%" height="350" frameborder="0" :src="src"> </iframe>
|
<div class="loading" v-if="loading">正在加载中...(第一次打开会有点慢)</div>
|
||||||
|
<div v-if="!loading">
|
||||||
|
<p class="tip">提醒:</p>
|
||||||
|
<p>1. 点击【下一步】开始调试(也可以拖动进度条)</p>
|
||||||
|
<p>
|
||||||
|
2. 点击
|
||||||
|
<n-button text type="primary" @click="close">修改代码</n-button>
|
||||||
|
完成修改后可再次调试
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<iframe
|
||||||
|
width="100%"
|
||||||
|
height="350"
|
||||||
|
frameborder="0"
|
||||||
|
:src="src"
|
||||||
|
ref="main"
|
||||||
|
></iframe>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import qs from "query-string"
|
import qs from "query-string"
|
||||||
import { onMounted, ref } from "vue"
|
import { onMounted, ref, useTemplateRef } from "vue"
|
||||||
import { code } from "../composables/code"
|
import { code, debug } from "../composables/code"
|
||||||
|
|
||||||
const src = ref("")
|
const src = ref("")
|
||||||
|
const loading = ref(true)
|
||||||
|
const main = useTemplateRef("main")
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// const url = "http://localhost:8000"
|
// const url = "http://localhost:8000"
|
||||||
@@ -21,5 +39,22 @@ onMounted(() => {
|
|||||||
"&cumulative=false&curInstr=0&heapPrimitives=nevernest&origin=opt-frontend.js&py=3&rawInputLstJSON=%5B%5D&textReferences=true"
|
"&cumulative=false&curInstr=0&heapPrimitives=nevernest&origin=opt-frontend.js&py=3&rawInputLstJSON=%5B%5D&textReferences=true"
|
||||||
const query = part1 + part2
|
const query = part1 + part2
|
||||||
src.value = base + "#" + query
|
src.value = base + "#" + query
|
||||||
|
|
||||||
|
main.value!.addEventListener("load", () => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
debug.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.loading {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tip {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Icon } from "@iconify/vue"
|
|||||||
import { useMessage } from "naive-ui"
|
import { useMessage } from "naive-ui"
|
||||||
import SelectLanguage from "../components/SelectLanguage.vue"
|
import SelectLanguage from "../components/SelectLanguage.vue"
|
||||||
import ThemeButton from "../components/ThemeButton.vue"
|
import ThemeButton from "../components/ThemeButton.vue"
|
||||||
import { code, debug, loading, run, share, size } from "../composables/code"
|
import { loading, run, share, size } from "../composables/code"
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
@@ -11,10 +11,6 @@ function handleShare() {
|
|||||||
share()
|
share()
|
||||||
message.success("分享链接已复制")
|
message.success("分享链接已复制")
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDebug() {
|
|
||||||
debug.value = true
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -25,9 +21,6 @@ function handleDebug() {
|
|||||||
<div class="title">徐越的自测猫</div>
|
<div class="title">徐越的自测猫</div>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
<n-flex>
|
<n-flex>
|
||||||
<n-button quaternary type="error" v-if="code.value && code.language === 'python'" @click="handleDebug">
|
|
||||||
调试
|
|
||||||
</n-button>
|
|
||||||
<n-button quaternary @click="handleShare">分享</n-button>
|
<n-button quaternary @click="handleShare">分享</n-button>
|
||||||
<ThemeButton />
|
<ThemeButton />
|
||||||
<n-input-number
|
<n-input-number
|
||||||
|
|||||||
@@ -27,10 +27,10 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useMessage } from "naive-ui"
|
import { useMessage } from "naive-ui"
|
||||||
|
import qs from "query-string"
|
||||||
import { onMounted, ref } from "vue"
|
import { onMounted, ref } from "vue"
|
||||||
import { createCode, listCode, removeCode } from "../api"
|
import { createCode, listCode, removeCode } from "../api"
|
||||||
import { code } from "../composables/code"
|
import { code } from "../composables/code"
|
||||||
import qs from "query-string"
|
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from "vue"
|
import { computed } from "vue"
|
||||||
import { code } from "../composables/code"
|
import { code } from "../composables/code"
|
||||||
import { cSymbols, insertText, pythonSymbols, getText } from "../composables/helper"
|
import {
|
||||||
|
cSymbols,
|
||||||
|
getText,
|
||||||
|
insertText,
|
||||||
|
pythonSymbols,
|
||||||
|
} from "../composables/helper"
|
||||||
|
|
||||||
function insert(text: string) {
|
function insert(text: string) {
|
||||||
insertText.value = text
|
insertText.value = text
|
||||||
|
|||||||
Reference in New Issue
Block a user