spz-script
When to use
- When you need to implement special logic with JavaScript.
- When you need to process data.
Code Demonstration
Basic Usage
Scripts are executed asynchronously in a Web Worker by default, without affecting the loading of other content on the page.
In the script, only exported functions can be used externally. Exported functions need to be exported using exportFunction, where the first argument is a string representing the name of the function to export; the second argument is which function of the exported script.
In the example below, we use a custom script to implement entering multiple pieces of information, using a spz-render to render the entered information.
Properties
Methods
execute
Executes a function within the script.
Events
[functionName]
When using execute to execute a function, an event with the same name as the function is automatically triggered.
AI Summary (LLM Ready)
- Component ID:
spz-script - One-line purpose: Used to write asynchronous JavaScript code.
- Detected attribute rows: 0
- Detected method subsections: 1
- Detected event subsections: 1
- Top attribute names: none (needs manual completion)
- Top method names:
execute - Top event names:
[functionName] - Reading order: start from usage/examples, then verify attributes, methods, and events.
- Related docs: /en/guide/actions-and-events/ , /en/guide/layouts/