sablesoft/yii2-vue
Composer 安装命令:
composer require sablesoft/yii2-vue
包简介
Vue.js manager component for yii2 web application
README 文档
README
This is the component for the yii2 app. This is the component for the application. It is a manager that allows you to conveniently manage settings and rendering of Vue.js.
Installation
The preferred way to install the vueManager is through composer.
Either run
composer require sablesoft/yii2-vue
or add
"sablesoft/yii2-vue": "*",
to the require section of your composer.json.
Then add vueManager in your app config:
... 'components' => [ ... 'vueManager' => [ 'class' => 'sablesoft\vue\VueManager', 'delimiters' => [ '[[', ']]' ], // specify custom for smarty 'isDev' => true // false is default ], ... ],
How to Use
Just use vueManager::register method in your controller before rendering:
Yii::$app->vueManager->register([ 'type' => 'instance', // is default, use 'component' type // to register vue component // html element id (for vue class instance): 'id' => 'buy-number', // vue class instance var name: 'jsName' => 'buyNumber', // path to your vue app sources ( see details below ): 'sourcePath' => '@yourAlias/path/to/vueApp/sources', // your vue app reactive data: 'data' => [ 'routes' => $yourRoutes, 'flags' => $someCustomFlags, 'model' => $yourModel->getAttributes(), ... ], // use jsExpression wrapper for short js // for long js use sourcePath ( see below ): 'created' => new JsExpression( "function() { console.log('Vue created!')}" ), // also you can use string value as path to your js: 'computed' => '@yourAlias/path/to/computed.js', // for vue 'component' type: 'props' => [...], 'template' => '<li><span>...</span></li>' ]);
Vue Source Path
Use sorcePath for simple development and maintenance of complex vue apps and components. Just put all your js files for your vue app in one place. For example:
-app\
...
views\
// your controller views:
hello\
// source path to vue - @app/views/hello/index
index\
// use 'components' directory for required components:
components\
// subdirectory name - is component tag
compA\
props.js
template.html
compB\
props.js
template.html
...
// your vue app or component fields:
computed.js
methods.js
created.js
// your action view:
index.tpl
Source JS Syntax
JS files in your sourcePath must have a specific syntax. For js objects use this wrappers:
(function(){ return { fieldA : 'fieldValue', fieldB : function(){...}, ... } })();
For single functions as 'created', 'mounted' and similar you can use the usual syntax:
function created() { console.log('Vue app created!'); }
And don't forget for vue chrome extension! :)
sablesoft/yii2-vue 适用场景与选型建议
sablesoft/yii2-vue 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 01 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「lodash」 「yii2」 「vuejs」 「vue」 「yii2-vue」 「axios」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sablesoft/yii2-vue 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sablesoft/yii2-vue 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sablesoft/yii2-vue 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A full-on PHP manipulation utility-belt that provides support for the usual functional.
Add more functional to Laravel
A port of Lodash to PHP (forked)
A functional programming library for PHP. Inspired by Underscore, Lodash, and Ramda.
A component that allows creating responsive HTML tables or lists from data object
A custom URL rule class for Yii 2 which allows to create translated URL rules
统计信息
- 总下载量: 30
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2019-01-20