update
This commit is contained in:
@@ -1,21 +1,42 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { insertText } from "../composables/helper"
|
import { insertText } from "../composables/helper"
|
||||||
|
import { code } from "../composables/code"
|
||||||
|
import { computed } from "vue"
|
||||||
|
|
||||||
function insert(text: string) {
|
function insert(text: string) {
|
||||||
insertText.value = text
|
insertText.value = text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const texts = computed(() => {
|
||||||
|
if (code.language === "c") return [",", ";", "printf();", "{\n}", "int", "%d"]
|
||||||
|
else
|
||||||
|
return [
|
||||||
|
":",
|
||||||
|
"=",
|
||||||
|
"==",
|
||||||
|
"print()",
|
||||||
|
"input()",
|
||||||
|
"if",
|
||||||
|
"else",
|
||||||
|
"elif",
|
||||||
|
"for",
|
||||||
|
"in",
|
||||||
|
"range",
|
||||||
|
"while",
|
||||||
|
]
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<n-flex align="center" class="container">
|
<n-flex align="center" class="container" wrap>
|
||||||
<span>编程助手</span>
|
<span>编程助手</span>
|
||||||
<n-button size="small" @click="insert(':')">:</n-button>
|
<n-button v-for="it in texts" :key="it" size="small" @click="insert(it)">
|
||||||
<n-button size="small" @click="insert('=')">=</n-button>
|
{{ it }}
|
||||||
<n-button size="small" @click="insert('print')">print</n-button>
|
</n-button>
|
||||||
<n-button size="small" @click="insert('input')">input</n-button>
|
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.container {
|
.container {
|
||||||
|
padding: 0 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user