是否可以向NavBar添加文本框,以便用户可以在菜单栏中输入用户名和密码而不是登录页面?
答案 0 :(得分:2)
您可以在布局内的导航栏中添加表单。
示例提供的是基本表单,但您可以使用activeForm for yii2并将该字段与模型(用户o LoginForm)相关联
这是main.php布局的一部分(在yourapp / frontend / layout中),并在导航栏的末尾添加两个输入字段..
<body>
<?php $this->beginBody() ?>
<div class="wrap">
<?php
NavBar::begin([
'brandLabel' => 'MyBrand',
'brandUrl' => Yii::$app->homeUrl,
'brandOptions' =>[
'style' => 'font-family: palatino; font-size:24px;'
],
'options' => [
//'class' => 'navbar-inverse navbar-fixed-top',
'class' => 'navbar navbar-default navbar-fixed-top',
],
]);
......
.......
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $menuItems,
'encodeLabels' => false,
]);
?>
<form>
First name:
<input style="display: inline;" type="text" name="firstname">
Last name:
<input style="display: inline;" type="text" name="lastname">
</form>
<?php
NavBar::end();
?>
答案 1 :(得分:0)
输入:
Option Compare Database
Option Explicit
Private CALL1_DATE_ As Date ' SAME AS: Dim CALL1_DATE_ As Date
Private CALL2_DATE_ As Date ' SAME AS: Dim CALL2_DATE_ As Date
Private Sub CALL1_DATE__DblClick(Cancel As Integer)
CALL1_DATE_ = Now()
End Sub
Private Sub CALL2_DATE_DblClick(Cancel As Integer)
CALL2_DATE_ = Now()
End Sub
在 $menuItems[] = '<li>'
. Html::beginForm($action = '', $method = '', $options = [])
. Html::textInput('search', '', [])
. Html::endForm()
. '</li>';
之前
就这样