yii2-vue-js vue.js library for yii2

  1. Installation
  2. Usage
  3. Resources

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require aki/yii2-vue "*"

or add

"aki/yii2-vue": "*"

Usage

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

<?php
use aki\vue\Vue;
?>
<?php Vue::begin([
    'id' => "vue-app",
    'data' => [
        'message' => "hello",
        'seen' => false,
        'todos' => [
            ['text' => "text"],
            ['text' => "akbar joudi"]
        ]
    ],
    'methods' => [
        'reverseMessage' => new yii\web\JsExpression("function(){"
                . "this.message =1; "
                . "}"),
    ]
]); ?>

    <p>{{ message }}</p>
    <button v-on:click="reverseMessage">Reverse Message</button>

    <p v-if="seen">Now you see me</p>


    <ol>
        <li v-for="todo in todos">
          {{ todo.text }}
        </li>
    </ol>

    <p>{{ message }}</p>
    <input v-model="message">


<?php Vue::end(); ?>

Resources

1 0
4 followers
0 downloads
Yii Version: 2.0.*
License: MIT
Category: User Interface
Developed by: akii
Created on: Apr 1, 2017
Last updated: 4 years ago

Related Extensions