error500/yii2-bootstrap-vue

Replace for yii2-bootstrap

Installs: 238

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Type:yii2-extension

0.0.3-rc2 2022-01-31 07:11 UTC

This package is auto-updated.

Last update: 2024-04-07 11:13:23 UTC


README

Replace for yii2-bootstrap

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist error500/yii2-bootstrap-vue "*"

or add

"error500/yii2-bootstrap-vue": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

  • Add vueApp component to config of your web application
    componets => [
        ...
        'vueApp' => [
            'class' => 'yii\bootstrap_vue\VueObject',
        ],
        ...
    ]

Add VueAsset in view

    VueAsset::register($this);

Use widget

<?php $form = \yii\bootstrap_vue\widgets\ActiveForm::begin(); ?>
    <div class="row">
        <div class="col-xs-12 col-md-6">
            <?php echo $form->field($model, 'attribute', [])
                    ->text()
                    ->label();
            ?>
        </div>
    </div>
<?php \yii\bootstrap_vue\widgets\ActiveForm; ?>

Add bootstrap-vue http://bootstrap-vue.org/docs/components in view file

<?php
BootsrapVueAsset::register($this);
Yii::$app->vueApp->methods = [
    'fileChange' => 'function(file){
        ... some javascript code of root vue app object method ...
    }'
]
Yii::$app->vueApp->data = [
    'file' => null,
];
>
<b-container>
    <b-row>
...
        <b-form-file @change="fileChange" v-model="file"></b-form-file>
...
    </b-row>
<b-container>

Work with main Vue app in any place of your code

Yii::$app->vueApp->data = [
    'prop1' => null,
    'prop2' => false,
    'prop3' => string,
]

Yii::$app->vueApp->methods = [
    'methodName' => 'function(args) {
        method javascript code
    }'
]
Yi::$app->vueApp->computed = [
    'computedPropName' => 'function(){ javascript }'
]