mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
fix: improve lowcode
This commit is contained in:
parent
5870c0f261
commit
32488e898e
@ -112,29 +112,6 @@ LowcodeBlockFlowModel.registerFlow({
|
|||||||
minHeight: '400px',
|
minHeight: '400px',
|
||||||
theme: 'light',
|
theme: 'light',
|
||||||
enableLinter: true,
|
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);`,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -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' })}}`;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user