feat: 添加了前端工具

This commit is contained in:
zerlei 2024-09-28 00:14:20 +08:00
parent 0e32d8c64b
commit 468701b9ed
9 changed files with 70 additions and 73 deletions

View file

@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/sync.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue</title>
<title>文件同步</title>
</head>
<body>
<div id="app"></div>

View file

@ -9,6 +9,8 @@
"preview": "vite preview"
},
"dependencies": {
"monaco-editor": "0.33.0",
"monaco-editor-vue3": "^0.1.10",
"vue": "^3.4.21"
},
"devDependencies": {

View file

@ -0,0 +1 @@
<svg t="1727447742081" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4476" width="200" height="200"><path d="M920.5 491.6c-20.7-26.7-48.3-47.8-79.3-60.7-5.7-73.5-37-141.8-89.7-194.5-58.5-58.5-136.2-90.7-218.9-90.7-68.2 0-132.9 21.7-187.1 62.9-26 19.8-48.7 43.4-67.3 70.2-14.6 21.1-26.5 43.7-35.5 67.6-46.2 11-88.1 36.2-119.8 72.2-37.2 42.2-57.7 96.5-57.7 152.8 0 47.7 14.4 93.5 41.7 132.5 26.6 38.1 63.5 67 106.7 83.6 4.2 1.6 8.6 2.4 12.9 2.4 14.5 0 28.1-8.8 33.6-23.1 7.1-18.6-2.1-39.4-20.7-46.5-29.8-11.4-55.2-31.4-73.6-57.6-18.8-26.8-28.7-58.4-28.7-91.2 0-38.8 14.1-76.2 39.7-105.3 25.4-28.8 60.2-47.5 98-52.7h0.2c0.5-0.1 0.9-0.1 1.4-0.2 0.2 0 0.3-0.1 0.5-0.1 0.4-0.1 0.8-0.2 1.1-0.2 0.3-0.1 0.5-0.1 0.8-0.2 0.3-0.1 0.5-0.1 0.8-0.2 0.3-0.1 0.7-0.2 1-0.3 0.2 0 0.3-0.1 0.5-0.1 0.4-0.1 0.9-0.3 1.3-0.5 0 0 0.1 0 0.1-0.1 3.3-1.2 6.3-2.9 9-4.9h0.1c0.4-0.3 0.8-0.6 1.2-1 0.1-0.1 0.2-0.2 0.4-0.3 0.3-0.3 0.6-0.5 0.9-0.8 0.2-0.2 0.4-0.4 0.7-0.6 0.2-0.2 0.4-0.3 0.5-0.5l0.9-0.9 0.3-0.3c0.3-0.4 0.7-0.8 1-1.1l0.1-0.1c0.3-0.4 0.7-0.8 1-1.3l0.1-0.1c0.3-0.4 0.6-0.9 0.9-1.3l0.1-0.1c0.3-0.4 0.5-0.8 0.8-1.2 0.1-0.1 0.1-0.2 0.2-0.3 0.2-0.4 0.4-0.7 0.6-1.1 0.1-0.2 0.2-0.3 0.3-0.5 0.2-0.3 0.3-0.6 0.5-0.9 0.1-0.3 0.3-0.5 0.4-0.8 0.1-0.2 0.2-0.4 0.3-0.7 0.2-0.4 0.3-0.7 0.5-1.1 0.1-0.1 0.1-0.3 0.2-0.4 0.2-0.5 0.4-0.9 0.5-1.4 0-0.1 0-0.1 0.1-0.2 0.2-0.6 0.4-1.1 0.5-1.7 14.2-48.2 44.2-91.5 84.4-122.1 41.6-31.5 91.2-48.2 143.5-48.2 63.5 0 123.1 24.7 168 69.6 44.9 44.9 69.6 104.5 69.6 168 0 11.5 5.4 21.8 13.8 28.3 4.2 4.1 9.4 7.2 15.5 8.8 52.6 14.5 89.4 62.8 89.4 117.5 0 22.8-11 51.2-28.6 73.9-16.3 21-35.9 34-51.2 34-19.9 0-36 16.1-36 36s16.1 36 36 36c38.2 0 77.5-22.6 108.1-61.9 27.4-35.3 43.8-79.4 43.8-118.1-0.1-43.1-14-84-40.4-118.2z" fill="#1296db" p-id="4477"></path><path d="M687.2 678.7H335.4c-8.2 0-16.4 2.8-23.1 8.4-0.8 0.7-1.6 1.4-2.4 2.2-5.4 5.4-8.7 12.1-9.9 19.1-0.4 2.3-0.6 4.6-0.5 6.9 0.1 8.3 3.1 16.6 9.1 23.2l93.8 104.4c7.1 7.9 16.9 11.9 26.8 11.9 8.6 0 17.2-3 24-9.2 7.9-7.1 11.9-16.9 11.9-26.8 0-8.6-3-17.2-9.2-24l-39.8-44.4h271c19.9 0 36-16.1 36-36s-16-35.7-35.9-35.7zM299.5 586.7c0 19.9 16.1 36 36 36h351.8c8.1 0 16.3-2.7 23-8.3 0.9-0.7 1.7-1.5 2.5-2.3 5.4-5.4 8.7-12.1 10-19.2 0.4-2.3 0.6-4.5 0.5-6.8-0.1-8.3-3.1-16.6-9-23.3L621 458.4c-13.2-14.8-36-16.1-50.8-2.9-8 7.1-12 17-12 26.9 0 8.5 3 17.1 9.2 24l39.7 44.4H335.5c-19.9-0.1-36 16-36 35.9z" fill="#1296db" p-id="4478"></path></svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -1,31 +1,44 @@
<script setup>
import HelloWorld from './components/HelloWorld.vue'
import MonacoEditor from 'monaco-editor-vue3';
import { ref } from 'vue';
const options = ref({
colorDecorators: true,
lineHeight: 24,
tabSize: 2,
})
// let config = {
// x:10,
// y:20
// }
const code = ref(`
config = {
x:10,
y:20
}
`)
function submit() {
var config = {}
// const config = eval(code.value)
eval(code.value)
console.log(config)
}
</script>
<template>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
<h3>发布工具</h3>
<div>发布历史</div>
<div style="display: flex;">
<MonacoEditor theme="vs-dark" :options="options" language="javascript" :width="800" :height="700"
v-model:value="code"></MonacoEditor>
<div style="width: 800px;height: 700px;background-color: #1e1e1e;">
发布日志
</div>
<HelloWorld msg="Vite + Vue" />
</div>
<button style="margin-top: 20px;" @click="submit">发布</button>
</template>
<script>
</script>
<style scoped>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
<style scoped></style>

View file

@ -0,0 +1 @@
<svg t="1727447742081" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4476" width="200" height="200"><path d="M920.5 491.6c-20.7-26.7-48.3-47.8-79.3-60.7-5.7-73.5-37-141.8-89.7-194.5-58.5-58.5-136.2-90.7-218.9-90.7-68.2 0-132.9 21.7-187.1 62.9-26 19.8-48.7 43.4-67.3 70.2-14.6 21.1-26.5 43.7-35.5 67.6-46.2 11-88.1 36.2-119.8 72.2-37.2 42.2-57.7 96.5-57.7 152.8 0 47.7 14.4 93.5 41.7 132.5 26.6 38.1 63.5 67 106.7 83.6 4.2 1.6 8.6 2.4 12.9 2.4 14.5 0 28.1-8.8 33.6-23.1 7.1-18.6-2.1-39.4-20.7-46.5-29.8-11.4-55.2-31.4-73.6-57.6-18.8-26.8-28.7-58.4-28.7-91.2 0-38.8 14.1-76.2 39.7-105.3 25.4-28.8 60.2-47.5 98-52.7h0.2c0.5-0.1 0.9-0.1 1.4-0.2 0.2 0 0.3-0.1 0.5-0.1 0.4-0.1 0.8-0.2 1.1-0.2 0.3-0.1 0.5-0.1 0.8-0.2 0.3-0.1 0.5-0.1 0.8-0.2 0.3-0.1 0.7-0.2 1-0.3 0.2 0 0.3-0.1 0.5-0.1 0.4-0.1 0.9-0.3 1.3-0.5 0 0 0.1 0 0.1-0.1 3.3-1.2 6.3-2.9 9-4.9h0.1c0.4-0.3 0.8-0.6 1.2-1 0.1-0.1 0.2-0.2 0.4-0.3 0.3-0.3 0.6-0.5 0.9-0.8 0.2-0.2 0.4-0.4 0.7-0.6 0.2-0.2 0.4-0.3 0.5-0.5l0.9-0.9 0.3-0.3c0.3-0.4 0.7-0.8 1-1.1l0.1-0.1c0.3-0.4 0.7-0.8 1-1.3l0.1-0.1c0.3-0.4 0.6-0.9 0.9-1.3l0.1-0.1c0.3-0.4 0.5-0.8 0.8-1.2 0.1-0.1 0.1-0.2 0.2-0.3 0.2-0.4 0.4-0.7 0.6-1.1 0.1-0.2 0.2-0.3 0.3-0.5 0.2-0.3 0.3-0.6 0.5-0.9 0.1-0.3 0.3-0.5 0.4-0.8 0.1-0.2 0.2-0.4 0.3-0.7 0.2-0.4 0.3-0.7 0.5-1.1 0.1-0.1 0.1-0.3 0.2-0.4 0.2-0.5 0.4-0.9 0.5-1.4 0-0.1 0-0.1 0.1-0.2 0.2-0.6 0.4-1.1 0.5-1.7 14.2-48.2 44.2-91.5 84.4-122.1 41.6-31.5 91.2-48.2 143.5-48.2 63.5 0 123.1 24.7 168 69.6 44.9 44.9 69.6 104.5 69.6 168 0 11.5 5.4 21.8 13.8 28.3 4.2 4.1 9.4 7.2 15.5 8.8 52.6 14.5 89.4 62.8 89.4 117.5 0 22.8-11 51.2-28.6 73.9-16.3 21-35.9 34-51.2 34-19.9 0-36 16.1-36 36s16.1 36 36 36c38.2 0 77.5-22.6 108.1-61.9 27.4-35.3 43.8-79.4 43.8-118.1-0.1-43.1-14-84-40.4-118.2z" fill="#1296db" p-id="4477"></path><path d="M687.2 678.7H335.4c-8.2 0-16.4 2.8-23.1 8.4-0.8 0.7-1.6 1.4-2.4 2.2-5.4 5.4-8.7 12.1-9.9 19.1-0.4 2.3-0.6 4.6-0.5 6.9 0.1 8.3 3.1 16.6 9.1 23.2l93.8 104.4c7.1 7.9 16.9 11.9 26.8 11.9 8.6 0 17.2-3 24-9.2 7.9-7.1 11.9-16.9 11.9-26.8 0-8.6-3-17.2-9.2-24l-39.8-44.4h271c19.9 0 36-16.1 36-36s-16-35.7-35.9-35.7zM299.5 586.7c0 19.9 16.1 36 36 36h351.8c8.1 0 16.3-2.7 23-8.3 0.9-0.7 1.7-1.5 2.5-2.3 5.4-5.4 8.7-12.1 10-19.2 0.4-2.3 0.6-4.5 0.5-6.8-0.1-8.3-3.1-16.6-9-23.3L621 458.4c-13.2-14.8-36-16.1-50.8-2.9-8 7.1-12 17-12 26.9 0 8.5 3 17.1 9.2 24l39.7 44.4H335.5c-19.9-0.1-36 16-36 35.9z" fill="#1296db" p-id="4478"></path></svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

Before

Width:  |  Height:  |  Size: 496 B

View file

@ -1,40 +0,0 @@
<script setup>
import { ref } from 'vue'
defineProps({
msg: String,
})
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Install
<a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
in your IDE for a better DX
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>

View file

@ -1,5 +1,27 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import { createApp } from 'vue';
import './style.css';
import App from './App.vue';
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
createApp(App).mount('#app')
self.MonacoEnvironment = {
getWorker(_, label) {
if (label === 'json') {
return new jsonWorker();
}
if (label === 'css' || label === 'scss' || label === 'less') {
return new cssWorker();
}
if (label === 'html' || label === 'handlebars' || label === 'razor') {
return new htmlWorker();
}
if (label === 'typescript' || label === 'javascript') {
return new tsWorker();
}
return new editorWorker();
},
};
createApp(App).mount('#app');