如何使用Tabs小部件Yii2在标签中放置多个字段?

时间:2016-06-21 22:38:39

标签: php yii yii2

此代码仅显示第二个字段,我需要两个字段。感谢。

<?php echo Tabs::widget([
'items' => [
    [
        'label' => 'One',
        'content' => $form->field($model, 'name'),
    'content' => $form->field($model, 'type'),
        'active' => true
    ],
    ........

2 个答案:

答案 0 :(得分:1)

请参阅docs

echo Tabs::widget([
    'items' => [
        [
            'label' => 'One',
            'content' => 'Anim pariatur cliche...',
            'active' => true
        ],
        [
            'label' => 'Two',
            'content' => 'Anim pariatur cliche...',
            'headerOptions' => [...],
            'options' => ['id' => 'myveryownID'],
        ],
        [
            'label' => 'Example',
            'url' => 'http://www.example.com',
        ],
        [
            'label' => 'Dropdown',
            'items' => [
                 [
                     'label' => 'DropdownA',
                     'content' => 'DropdownA, Anim pariatur cliche...',
                 ],
                 [
                     'label' => 'DropdownB',
                     'content' => 'DropdownB, Anim pariatur cliche...',
                 ],
            ],
        ],
    ],
]);

答案 1 :(得分:0)

<?= Tabs::widget([
    'items' => [
        [
            'label' => 'General',
            'content' => $this->render('product_form1', ['model' => $model, 'form' => $form]),
            'active' => true
        ],