跳到主要内容

block

section block 的内容和 settings。

Sections 和 blocks 是构成 templates 的可复用内容模块。

Properties

Type

Description

id

number

block 的 ID,由 Shoplazza 动态生成。

settings

block 的 settings

要了解如何访问 settings,请参阅访问 settings。要了解哪些 input settings 可以应用于 settings 中的 type 属性,请参阅 Input settings

shoplaza_attributes

string

block 的数据属性,用于 theme editor。

theme editor 的 JavaScript API 使用数据属性来识别 blocks 并监听事件。在 theme editor 之外,block.shoplaza_attributes 不返回值。

type

string

block 的类型。

类型是在 block 的 schema 中定义的自由格式字符串,可用作标识符。例如,您可以根据 block 类型显示不同的标记。

{
"id": "0",
"type": "announcement",
"settings": {},
"shoplaza_attributes": "data-shoplaza-editor-block=\"{\"index\":0,\"type\":\"announcement\"}"
}