提交 7e53a074 编写于 作者: 璃白.'s avatar 璃白. 🌻

fix

上级 ca98dca1
...@@ -215,11 +215,13 @@ ...@@ -215,11 +215,13 @@
font-size: 90%; font-size: 90%;
text-transform: uppercase; text-transform: uppercase;
} }
pre { .jupyter_code pre {
white-space: pre-wrap; white-space: pre-wrap;
word-wrap: break-word; word-wrap: break-word;
margin: 0 0 14px; margin: 0 0 14px;
overflow-x: auto; overflow-x: auto;
background: inherit;
border: none;
code { code {
overflow-x: auto; overflow-x: auto;
white-space: pre; white-space: pre;
...@@ -390,13 +392,16 @@ p[align="center"] { ...@@ -390,13 +392,16 @@ p[align="center"] {
.jupyter_container em strong { .jupyter_container em strong {
font-style: italic; font-style: italic;
} }
.jupyter_container p,
.jupyter_container h1, .jupyter_container h1,
.jupyter_container h2, .jupyter_container h2,
.jupyter_container h3, .jupyter_container h3,
.jupyter_container h4, .jupyter_container h4,
.jupyter_container h5, .jupyter_container h5,
.jupyter_container h6 { .jupyter_container h6 {
// color: #4f4f4f; color: #abb2bf;
border: none;
margin: 0;
// margin: 8px 0 16px; // margin: 8px 0 16px;
font-weight: 700; font-weight: 700;
} }
......
<svg t="1631789535144" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" width="200" height="200"><path d="M518.86 921.21c-224.81 0-407.71-182.9-407.71-407.71S294 105.79 518.86 105.79s407.71 182.9 407.71 407.71-182.9 407.71-407.71 407.71z m0-754c-190.94 0-346.28 155.34-346.28 346.29s155.33 346.29 346.28 346.29S865.14 704.45 865.14 513.5 709.8 167.22 518.86 167.22z" p-id="2884" fill="#409eff"></path><path d="M392.17 386.81h253.38v253.38H392.17z" p-id="2885" fill="#409eff"></path></svg>
\ No newline at end of file
<template> <template>
<div> <div>
<div class="jupyter_input"> <div class="jupyter_input">
<div v-if="output" class="run_btn" @click="run"></div> <div v-if="output && !loading" class="run_btn" @click="run"></div>
<div v-if="output && loading" class="stop_btn"></div>
<div class="jupyter_code"> <div class="jupyter_code">
<pre><p v-html="input"></p></pre> <pre><p v-html="input"></p></pre>
</div> </div>
...@@ -74,7 +75,7 @@ export default defineComponent({ ...@@ -74,7 +75,7 @@ export default defineComponent({
data() { data() {
return { return {
showResult: false, showResult: false,
loading: true loading: false
}; };
}, },
methods: { methods: {
...@@ -127,15 +128,21 @@ export default defineComponent({ ...@@ -127,15 +128,21 @@ export default defineComponent({
padding-left: 52px; padding-left: 52px;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
.run_btn { .run_btn,
.stop_btn {
width: 32px; width: 32px;
height: 32px; height: 32px;
position: absolute; position: absolute;
left: 12px; left: 12px;
top: 12px; top: 12px;
}
.run_btn {
cursor: pointer; cursor: pointer;
background: url("../assets/img/run.svg") center / 24px no-repeat; background: url("../assets/img/run.svg") center / 24px no-repeat;
} }
.stop_btn {
background: url("../assets/img/stop.svg") center / 30px no-repeat;
}
} }
.jupyter_output { .jupyter_output {
background: rgb(58, 65, 79); background: rgb(58, 65, 79);
...@@ -146,9 +153,10 @@ export default defineComponent({ ...@@ -146,9 +153,10 @@ export default defineComponent({
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
.loading { .loading {
width: 32px; width: 24px;
height: 32px; height: 24px;
background: url("../assets/img/loading.svg") center / 24px no-repeat; margin: 0;
background: url("../assets/img/loading.svg") center / cover no-repeat;
animation: loading 2s linear infinite; animation: loading 2s linear infinite;
} }
:deep(.jupyter_result) { :deep(.jupyter_result) {
......
...@@ -2,18 +2,20 @@ import { createApp } from 'vue' ...@@ -2,18 +2,20 @@ import { createApp } from 'vue'
import App from './App.vue' import App from './App.vue'
import './assets/css/style.less'; import './assets/css/style.less';
// document.addEventListener('DOMContentLoaded', () => {
console.log('render jupyter')
const jupyterLinks = Array.from(document.querySelectorAll('a'))
document.addEventListener('DOMContentLoaded', () => { if (jupyterLinks.length) {
console.log('render jupyter') jupyterLinks.forEach(item => {
const jupyterLinks = Array.from(document.querySelectorAll('a')) const url = item.innerHTML
if (!url.includes('.ipynb')) return
if (jupyterLinks.length) { const targetEL = document.createElement('div')
jupyterLinks.forEach(item => { item.parentElement?.insertBefore(targetEL, item)
const url = item.innerHTML item.style.display = 'none'
if (url.includes('.ipynb')) createApp(App, {
createApp(App, { url
url }).mount(targetEL)
}).mount(item) })
}) };
}; // })
})
...@@ -3,6 +3,7 @@ import { defineConfig } from 'vite' ...@@ -3,6 +3,7 @@ import { defineConfig } from 'vite'
import path from 'path' import path from 'path'
export default defineConfig({ export default defineConfig({
base: './',
plugins: [vue()], plugins: [vue()],
resolve: { resolve: {
alias: { alias: {
...@@ -17,6 +18,15 @@ export default defineConfig({ ...@@ -17,6 +18,15 @@ export default defineConfig({
rewrite: (path) => path.replace(/^\/api/, '') rewrite: (path) => path.replace(/^\/api/, '')
} }
} }
},
build: {
rollupOptions: {
output: {
entryFileNames: 'assets/[name].js',
chunkFileNames: 'assets/[name].js',
assetFileNames: 'assets/[name].[ext]'
}
}
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册