johnsnook / yii2-stacked
使用我写的 jQuery 插件实现的一个标签式界面替代方案
v0.2
2018-07-04 22:00 UTC
Requires
- yiisoft/yii2-bootstrap: ^2.0
This package is not auto-updated.
Last update: 2024-09-22 09:33:54 UTC
README
前几天我在测试一些软件时,遇到了一个问题,就是记不清把某个功能放在了哪里。当我意识到这个功能一直就在我眼前,在标签页中时,我意识到这是一个机会。我开始思考如何在不让内容消失的情况下将其隐藏起来,这就是我的想法。
要求
- PHP >= v5.4
- Yii2 v2.14
- jQuery v3.x
- Bootstrap 3
安装
安装此扩展的首选方式是通过 composer。
运行
php composer.phar require --prefer-dist johnsnook/yii2-stacked "*"
或在 composer.json
文件的 require 部分添加
"johnsnook/yii2-stacked": "*"
到
使用方法
扩展安装后,您可以在视图中立即开始使用它
<?php use johnsnook\stacked\StackedWidget; use johnsnook\stacked\PanelWidget; ?> ....
PanelWidget 是完全可选的,因为 jQuery 插件将假定所选容器的所有顶级子元素都应该显示,但 PanelWidget 可以快速创建面板。最重要的是保持嵌套结构清晰,所有内容都在 StackedWidget::begin()
和 StackedWidget::end()
之间
... <?php StackedWidget::begin([ 'gutterSize' => 35, 'containerOptions' => ['style' => 'margin-top:40px; margin-bottom:40px;'], ]); /** the panel widget makes nice and easy bootstrap 3 panels */ PanelWidget::begin([ 'containerOptions' => ['class' => 'panel-success'], 'title' => "Panel #1" ]); ?> <p>The two British divers who found 12 missing boys and their football coach alive in a flooded cave in Thailand boast extensive experience. Rick Stanton and John Volanthen, who reached the group nine days after they vanished, are so well known among cave rescuers that they had reportedly been requested specially. Yet their work is entirely voluntary; one is a firefighter, the other a computer engineer. And far from glorying in their role, Mr Volanthen had brushed off reporters as he entered the cave, saying only: “We’ve got a job to do.”</p> <?php PanelWidget::end(); PanelWidget::begin([ 'containerOptions' => ['class' => 'panel-primary'], 'title' => "Panel #2" ]); ?> <p>An intensifying debate over Judge Brett M. Kavanaugh, a front-runner in President Trump’s search for a Supreme Court nominee, gripped Republicans on Tuesday, with conservative critics highlighting past rulings and his links to GOP leaders while his allies — including inside the White House — forcefully defended him.</p> <?php PanelWidget::end(); /** all panels should be closed with ::end() before closing the StackedWidget. */ StackedWidget::end(); ?>