From df105faee9fa8d328196872f97c49dbbc193c0a1 Mon Sep 17 00:00:00 2001 From: Arnaud Charleroy Date: Tue, 3 Dec 2019 09:40:37 +0100 Subject: [PATCH 1/3] Add vue integration readme --- docs/VueJsIntegration.md | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 docs/VueJsIntegration.md diff --git a/docs/VueJsIntegration.md b/docs/VueJsIntegration.md new file mode 100644 index 0000000..b8d32e3 --- /dev/null +++ b/docs/VueJsIntegration.md @@ -0,0 +1,44 @@ +# Vue.js Integration in Yii2 + +## Plugin application integration + +Add this plugin to composer.json +```bash +composer require antkaz/yii2-vue --ignore-platform-reqs +``` + +## View file integration + +In your php view files add this following code at the beginning : +```php +use antkaz\vue\VueAsset; +VueAsset::register($this); +``` +Now you can create Vue.js (v2) applications and component inside of your php view files. + +## Running example + +Add this code to your view file to test if Vue.js is working well. + +Example : +```html +
+

Trying out Vue.js

+

{{ message }}

+ +
+ + +``` \ No newline at end of file From 627c7690312717b0bd263ad349f7952e12c63c8f Mon Sep 17 00:00:00 2001 From: Arnaud Charleroy Date: Tue, 3 Dec 2019 09:45:41 +0100 Subject: [PATCH 2/3] Update documentation --- docs/VueJsIntegration.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/VueJsIntegration.md b/docs/VueJsIntegration.md index b8d32e3..ec4e831 100644 --- a/docs/VueJsIntegration.md +++ b/docs/VueJsIntegration.md @@ -2,19 +2,19 @@ ## Plugin application integration -Add this plugin to composer.json +Add 'antkaz/yii2-vue' plugin to your ``composer.json`` file : ```bash -composer require antkaz/yii2-vue --ignore-platform-reqs +composer require antkaz/yii2-vue --ignore-platform-reqs ``` ## View file integration -In your php view files add this following code at the beginning : +Add this following code at the beginning of php view files : ```php use antkaz\vue\VueAsset; VueAsset::register($this); ``` -Now you can create Vue.js (v2) applications and component inside of your php view files. +Now you can add Vue.js (v2) applications and components inside of your php view files. ## Running example @@ -41,4 +41,13 @@ new Vue({ } }) +``` + +## Add Vue;js plugins + +If you want to add Vue.js plugins, you need to register the +js and css file of this plugin using the function +```php +this->registerJsFile("{url of plugin Vue.js js file}"); +$this->registerCssFile("{url of plugin Vue.js css file}"); ``` \ No newline at end of file From b26fda159c9d9a0120f07eebfa7241402b8c7f9a Mon Sep 17 00:00:00 2001 From: Arnaud Charleroy Date: Tue, 3 Dec 2019 09:46:24 +0100 Subject: [PATCH 3/3] correct typo --- docs/VueJsIntegration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/VueJsIntegration.md b/docs/VueJsIntegration.md index ec4e831..73d1b86 100644 --- a/docs/VueJsIntegration.md +++ b/docs/VueJsIntegration.md @@ -48,6 +48,6 @@ new Vue({ If you want to add Vue.js plugins, you need to register the js and css file of this plugin using the function ```php -this->registerJsFile("{url of plugin Vue.js js file}"); +$this->registerJsFile("{url of plugin Vue.js js file}"); $this->registerCssFile("{url of plugin Vue.js css file}"); ``` \ No newline at end of file