reactor:【infra 基础设施】build 进一步统一代码风格

pull/211/head
YunaiV 2025-09-09 23:24:31 +08:00
parent 0bff8bd7a9
commit 68f64c9d67
1 changed files with 15 additions and 18 deletions

View File

@ -24,7 +24,6 @@ const [Modal, modalApi] = useVbenModal();
const designer = ref(); //
//
// TODO @puhui999 package.json
const designerConfig = ref({
switchType: [], // ,
autoActive: true, //
@ -61,34 +60,34 @@ const formData = ref(''); // 表单数据
useFormCreateDesigner(designer); //
/** 打开弹窗 */
const openModel = (title: string) => {
function openModel(title: string) {
dialogVisible.value = true;
dialogTitle.value = title;
modalApi.open();
};
}
/** 生成 JSON */
const showJson = () => {
function showJson() {
openModel('生成 JSON');
formType.value = 0;
formData.value = designer.value.getRule();
};
}
/** 生成 Options */
const showOption = () => {
function showOption() {
openModel('生成 Options');
formType.value = 1;
formData.value = designer.value.getOption();
};
}
/** 生成组件 */
const showTemplate = () => {
function showTemplate() {
openModel('生成组件');
formType.value = 2;
formData.value = makeTemplate();
};
}
const makeTemplate = () => {
function makeTemplate() {
const rule = designer.value.getRule();
const opt = designer.value.getOption();
return `<template>
@ -112,10 +111,10 @@ const makeTemplate = () => {
}
init()
<\/script>`;
};
}
/** 复制 */
const copy = async (text: string) => {
async function copy(text: string) {
const textToCopy = JSON.stringify(text, null, 2);
const { copy, copied, isSupported } = useClipboard({ source: textToCopy });
if (isSupported) {
@ -126,12 +125,10 @@ const copy = async (text: string) => {
} else {
ElMessage.error('复制失败');
}
};
}
/**
* 代码高亮
*/
const highlightedCode = (code: string) => {
/** 代码高亮 */
function highlightedCode(code: string) {
//
let language = 'json';
if (formType.value === 2) {
@ -144,7 +141,7 @@ const highlightedCode = (code: string) => {
//
const result = hljs.highlight(code, { language, ignoreIllegals: true });
return result.value || '&nbsp;';
};
}
/** 初始化 */
onMounted(async () => {