fix: improve lowcode

This commit is contained in:
gchust 2025-06-24 09:41:43 +08:00
parent 5870c0f261
commit 32488e898e
2 changed files with 21 additions and 23 deletions

View File

@ -112,29 +112,6 @@ LowcodeBlockFlowModel.registerFlow({
minHeight: '400px',
theme: 'light',
enableLinter: true,
placeholder: `// Welcome to the lowcode block
// Build interactive components with JavaScript and external libraries
// Available variables:
// - element: The DOM element to render into
// - ctx: Flow context with globals (ctx.globals.api for NocoBase API)
// - model: Current model instance
// - requirejs: Function to load external JavaScript libraries (callback style)
// - requireAsync: Function to load external JavaScript libraries (async/await style)
// - loadCSS: Function to load external CSS files
// Example: Basic HTML content
// Create beautiful, interactive components
element.innerHTML = \`
<div style="padding: 20px; text-align: center; font-family: system-ui;">
<h3 style="color: #1890ff;">🚀 Welcome to Lowcode Block</h3>
<p>Start building your custom component here!</p>
</div>
\`;
// Example: Load external library
// const echarts = await requireAsync('echarts');
// const chart = echarts.init(element);`,
},
},
},

View File

@ -0,0 +1,21 @@
/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
// @ts-ignore
import pkg from '../../package.json';
import { useApp } from '@nocobase/client';
export function useT() {
const app = useApp();
return (str: string) => app.i18n.t(str, { ns: [pkg.name, 'client'] });
}
export function tStr(key: string) {
return `{{t(${JSON.stringify(key)}, { ns: ['${pkg.name}', 'client'], nsMode: 'fallback' })}}`;
}