本文实例为大家分享了Yii2选项卡使用的具体代码,供大家参考,具体内容如下
<!--选项卡开始--> <?php echo \yii\bootstrap\Tabs::widget([ "id" => "tabs", "renderTabContent" => false, //如果是每个选项卡里要显示的是自定义的DIV或者Render其他页面文件,就设为false. "linkOptions" => ["data-toggle" => "tab"], "items" => [ [ "label" => Yii::t("app", "帐号设置"), "content" => "", "headerOptions" => ["id" => "li_account"], //可设可不设 "url" => "#tab_account", "active" => true, ], [ "label" => Yii::t("app", "修改密码"), "content" => "", "headerOptions" => ["id" => "li_password"], "url" => "#tab_password", "active" => false, ], [ "label" => Yii::t("app", "绑定邮箱"), "content" => "", "headerOptions" => ["id" => "li_email"], "url" => "#tab_email", "active" => false, ] ] ]) ?> <div class="tab-content"> <!--修改个人信息--> <div class="tab-pane active"id="tab_account"> <!--ID要对应上面的第1个 item 的URL--> 内容.... </div> <!--修改密码--> <div class="tab-pane"id="tab_password"> <!--ID要对应上面的第2个 item 的URL--> 内容.... </div> <!--绑定邮箱--> <div class="tab-pane"id="tab_email"> <!--ID要对应上面的第3个 item 的URL--> 内容.... </div> </div> <!--选项卡结束-->