ubermanu/magento2-motu
最新稳定版本:1.0.1
Composer 安装命令:
composer require ubermanu/magento2-motu
包简介
An implementation of the island architecture for Magento 2
README 文档
README
An implementation of the island pattern for Magento 2.
The islands architecture encourages small, focused chunks of interactivity within server-rendered web pages. The output of islands is progressively enhanced HTML, with more specificity around how the enhancement occurs. Rather than a single application being in control of full-page rendering, there are multiple entry points. The script for these "islands" of interactivity can be delivered and hydrated independently, allowing the rest of the page to be just static HTML.
From Islands Architecture
Installation
composer require ubermanu/magento2-motu
Quick start
Create a new island block:
<?php namespace Vendor\Module\Block\Island; class Example extends \Ubermanu\Motu\View\Element\AbstractIsland { public function getClientMethod(): string { return 'load'; } }
Add the block to your layout:
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> <block class="Vendor\Module\Block\Island\Example" name="example" template="Vendor_Module::island/example.phtml" /> </referenceContainer> </body> </page>
That's it! The island will be rendered in the page and hydrated by the client-side script.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-29