定制 cngmc/dialogboxbslw 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

cngmc/dialogboxbslw

Composer 安装命令:

composer require cngmc/dialogboxbslw

包简介

Dialog Box Bootstrap Livewire

README 文档

README

  • version: 1.0 beta

    bla bla..

Installation, Requirements and Usage Instructions

Installation

composer require cngmc/dialogboxbslw

Requirements

Basic Usage Instructions

Sample Livewire component (livewire/sample.php)

    public function boot(): void
    {
        $dialogBox = [
            "box" => [
                'name' => 'sample',
                'id' => 'dialogbox-sample', // Bootstrap modal ID
                "contents" => [
                    'title' => 'Sample Title',
                    'body' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                    'cancelButtonText' => "Cancel",
                    'actionButtonText' => "Accept"
                ],
            ],
            'acceptFn' => function () {
                return $this->accept($this->dialogBoxes['sample']['box']['params'][0], $this->dialogBoxes['sample']['box']['params'][1]);
            },
            'cancelFn' => function () {
                return $this->cancel($this->dialogBoxes['sample']['box']['params'][0], $this->dialogBoxes['sample']['box']['params'][1]);
            }
        ];

        $this->setDialogBox('sample', $dialogBox);
    }


    private function accept($param1, $param2)
    {
        return 'accepted';
    }

    private function cancel($param1, $param2)
    {
        return 'canceled';
    }

Sample Livewire component blade file (livewire/sample.blade.php)

    <button wire:click="dialogBox('sample', 'openFn', '1', 'Test')" class="btn btn-primary">Open Dialog</button>
    <x-dialogboxbslw::dialog modal="dialogbox-sample" />

Advanced Usage

Customization View

php artisan vendor:publish --tag=dialogboxbslw --force

You can make the necessary adjustments for customized component design in the resources/views/vendor/dialogboxbslw/components/dialog.blade.php

Using dynamic data in dialog

Sample Livewire component (sample.php)

    use DialogBox {
        DialogBox::dialogBoxOpenFn as private parentDialogBoxOpenFn;
    }

    private function dialogBoxOpenFn($name, $params): bool
    {
        $this->dialogBoxes[$name]['box']['contents']['title'] = 'Custom Title Params 0: ' . $params[0]. ' Params 1: ' . $params[1];        $this->dialogBoxes[$name]['box']['contents']['title'] = 'Custom Title Params 0: ' . $params[0]. ' Params 1: ' . $params[1];
        
        $this->parentDialogBoxOpenFn($name);
    }

Testing

vendor/bin/phpunit

License

The DialogBoxBsLw package is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2024-07-02