dev
suixy 2 months ago
parent a2a532bd71
commit b9de90424d

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
{{ options }} <!-- {{ options }}-->
<umo-editor v-bind="options" ref="editorRef" /> <umo-editor v-bind="options" ref="editorRef" />
</div> </div>
</template> </template>
@ -122,10 +122,10 @@ const createContractTable = () => {
}; };
}; };
const options = ref({ const options = ref({
document: { templates: [
title: '', {
content: { title: '合同',
type: 'doc', description: '合同',
content: [ content: [
{ {
type: 'heading', type: 'heading',
@ -253,6 +253,13 @@ const options = ref({
content: [{ type: 'text', text: `\t日期\t\t\t\t\t\t\t日期` }] content: [{ type: 'text', text: `\t日期\t\t\t\t\t\t\t日期` }]
} }
] ]
}
],
document: {
title: '',
content: {
type: 'doc',
content: []
}, },
placeholder: { placeholder: {
en_US: 'Please enter the document content...', en_US: 'Please enter the document content...',
@ -276,23 +283,22 @@ const options = ref({
} }
}, },
onSave: async (e) => { onSave: async (e) => {
const editor = editorRef.value; console.log(e);
const html = editor.getHTML(); // const editor = editorRef.value;
console.log(html); // const html = editor.getHTML();
// console.log(html);
// const doc = new Document({ // const doc = new Document({
// sections: [{ children: parseHTML(editor.getHTML()) }] // sections: [{ children: parseHTML(editor.getHTML()) }]
// }); // });
// await download(doc); // await download(doc);
}, },
onChanged: async (e) => { onChanged: async (e) => {
const editor = editorRef.value; // const editor = editorRef.value;
const json = editor.getJSON(); // const json = editor.getJSON();
console.log(json); // console.log(json);
console.log(json.content.find((v) => v.type === 'table' && v.attrs?.id === 'contractTable')); // console.log(json.content.find((v) => v.type === 'table' && v.attrs?.id === 'contractTable'));
// json // json
editor.setContent(json, { emitUpdate: false }); // editor.setContent(json, { emitUpdate: false });
// const doc = new Document({ // const doc = new Document({
// sections: [{ children: prseHTML(editor.getHTML()) }] // sections: [{ children: prseHTML(editor.getHTML()) }]
// }); // });

@ -1,4 +1,5 @@
import { defineConfig, loadEnv } from 'vite'; import { defineConfig, loadEnv } from 'vite';
import basicSsl from '@vitejs/plugin-basic-ssl';
import createPlugins from './vite/plugins'; import createPlugins from './vite/plugins';
import autoprefixer from 'autoprefixer'; // css自动添加兼容性前缀 import autoprefixer from 'autoprefixer'; // css自动添加兼容性前缀
import path from 'path'; import path from 'path';
@ -17,16 +18,18 @@ export default defineConfig(({ mode, command }) => {
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
}, },
// https://cn.vitejs.dev/config/#resolve-extensions // https://cn.vitejs.dev/config/#resolve-extensions
plugins: createPlugins(env, command === 'build'), plugins: [createPlugins(env, command === 'build'), basicSsl()],
server: { server: {
host: '0.0.0.0', host: '0.0.0.0',
https: true,
port: Number(env.VITE_APP_PORT), port: Number(env.VITE_APP_PORT),
open: true, open: true,
proxy: { proxy: {
[env.VITE_APP_BASE_API]: { [env.VITE_APP_BASE_API]: {
target: 'http://localhost:8080', target: 'https://frp-off.com:47543',
changeOrigin: true, changeOrigin: true,
ws: true, ws: true,
secure: false,
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '') rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
} }
} }

Loading…
Cancel
Save