2

我创建了一个自定义按钮块,并希望在其他块中使用它,例如 CTA 或图标功能。我在一些插件中看到了这样的代码,它导出注册块:

export default registerBlockType( 'name_space/button', {

但现在我想将它导入另一个块以供将来使用。像这样的东西:

import CustomButton from '../custom-button/block';

我试过用 and 将它包含在另一个edit块的方法中。但每次我得到一个错误。{CustomButton}<CustomButton />

我有办法做这样的事情吗?

4

1 回答 1

0

您可以使用InnerBlocks在块中使用核心块或自定义块。请记住,它只能在块内使用一次。

于 2019-05-05T19:25:09.010 回答