这个标签组件在哪里下载呢
这个标签组件在哪里下载呢?没找到呢,在yiiChina里
这个标签组件在哪里下载呢?没找到呢,在yiiChina里
2016-11-01
1.下载 yii-bootstrap-tags https://github.com/niluzok/yii2-bootstrap-tags
2.下载 bootstrap-tags https://github.com/maxwells/bootstrap-tags
3.解压yii2-bootstrap-tags-master 重命名文件夹为 bootstrapTags,复制到 common\widgets下
4.修改common\widgets\bootstrapTags 文件夹下的 BootstrapTags.php 和 BootstrapTagsAsset.php 的命名空间为namespace common\widgets\bootstrapTags;
5.解压bootstrap-tags-master 重命名文件夹为 bootstrap-tags,复制到 \vendor\bower下
6.在视图文件中添加
<?= $form->field($model,'tags')->widget('common\widgets\bootstrapTags\BootstrapTags' ]); ?>
7.刷新控制器,在标签表单中输入标签 回车 就OK了
注:表单中的tags返回的是字符串,视频中返回的应该是数组,效果有点出入,需要在遍历标签之前打成数组。
举报