You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.7 KiB

<template>
<div class="container">
<div class="main">
<!-- <pre><code ref="editor" class="edit-text html" contenteditable="true" @input="highlightCode">console.log('Hello, World!');</code></pre> -->
<div class="edit-text" contenteditable="true" spellcheck="false">
<!-- <highlightjs ref="editor" :language="language" :code="code" v-model="code" contenteditable="true" @input="highlightCode"></highlightjs> -->
oisafkahsdkjfhasdf sdfhkjsahfdlkjas \n /n sldhfkajshfd salkdhflkasf asfasdf
</div>
</div>
<div class="setting">
<el-button>保存</el-button>
</div>
</div>
</template>
<script setup>
import { onMounted, ref } from "vue";
import hljs from "highlight.js/lib/core";
const editor = ref(null);
const code = ref('console.log("Hello, World!");');
const highlightCode = () => {
const codeBlock = editor.value;
console.log(codeBlock);
if (codeBlock) {
hljs.highlightElement(code);
}
};
onMounted(() => {
// highlightCode();
});
</script>
<style scoped>
.container {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
margin-top: 100px;
/* position: relative; */
}
.main {
width: 1442px;
height: 753px;
background-color: pink;
background: url("../../assets/images/idea.png") no-repeat;
background-size: contain;
background-position: center center;
position: relative;
}
.edit-text {
position: absolute;
left: 410px;
top: 60px;
width: 700px;
height: 670px;
background-color: #1e1e1e;
color: #fff;
font-family: "Courier New", monospace;
padding: 10px;
border-radius: 5px;
overflow: auto;
outline: none;
line-height: 30px;
}
.setting{
position: absolute;
top: 20px;
right: 100px;
}
</style>