【问题标题】:How to add multiple pages in grapesjs?如何在grapesjs中添加多个页面?
【发布时间】:2020-08-27 05:13:35
【问题描述】:

我想在grapesjs 框架中包含多个页面。

【问题讨论】:

    标签: javascript reactjs ecmascript-6 grapesjs


    【解决方案1】:

    Grapesjs 现在支持使用 PageManager 的页面。你可以在这里查看 API 文档https://grapesjs.com/docs/api/pages.html

    这样做的方法是

    const editor = grapesjs.init({
     ....
     pageManager: {
       pages: [
         {
           id: 'page-id',
           styles: `.my-class { color: red }`, // or a JSON of styles
           component: '<div class="my-class">My element</div>', // or a JSON of components
         }
      ]
     },
    })
    

    您可以使用grapesjs.Page中的方法添加、删除、选择页面。

    【讨论】:

      猜你喜欢
      • 2020-10-12
      • 2022-10-31
      • 2015-11-25
      • 2021-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多