承接 drago-ex/component 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drago-ex/component

最新稳定版本:v1.0.6

Composer 安装命令:

composer require drago-ex/component

包简介

Bootstrap components such as modal and offcanvas.

README 文档

README

Bootstrap components such as modal and offcanvas.

License: MIT PHP version Coding Style

Requirements

  • PHP >= 8.3
  • Nette Framework
  • Composer
  • Bootstrap
  • Naja
  • Node.js

Installation

composer require drago-ex/component

Usage

In the Control component we will use Trait Drago\Components\Component

Passing variables to the template:

$template->offcanvasId = $this->getUniqueIdComponent(self::Offcanvas);
$template->modalId = $this->getUniqueIdComponent(self::Modal);

And according to needs, we can use the implementations Drago\Component\ModalHandle and Drago\Component\OffcanvasHandle

#[Requires(ajax: true)] public function handleOpenModal(): void
{
	$this->modalComponent(self::Modal);
}


#[Requires(ajax: true)] public function handleOpenOffcanvas(): void
{
	$this->offCanvasComponent(self::Offcanvas);
}

Where do we insert the name of the snippet to override the component or can we write our own snippet handler and wrap the appropriate component in it.

#[Requires(ajax: true)] public function handleOpenModalWindow(): void
{
	$this->modalComponent();
	$this->redrawControl('...');
}

We will then use the templates of individual components and if we want to redraw multiple blocks, we need to add additional snippets.

<a n:href="openOffcanvas!" class="ajax" data-naja-history="off">Open Offcanvas</a>
{embed 'path/to/@offcanvas.latte', offcanvasId: $offcanvasId}
	{block title}Title{/block}
	{block body}
		{snippet offcanvas}
			...
		{/snippet}
	{/block}
{/embed}

<a n:href="openModal!" class="ajax" data-naja-history="off">Open Modal</a>
{embed 'path/to/@modal.latte', modalId: $modalId}
	{block title}Title{/block}
	{block body}
		{snippet modal}
			...
		{/snippet}
	{/block}
	{block footer}
		<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
			Close
		</button>
	{/block}
{/embed}

Next, it is necessary to import javascript to operate the component.

import BootstrapComponents from 'path/to/naja.component';

Copy the Latte templates from assets to your project.

统计信息

  • 总下载量: 135
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-01