tags功能组件与图片上传和富文本组件一样,把Tags压缩包下载解压后直接放到 common/widgets 下什么都不用改,也不用配置,然后就可以直接使用了
tag组件放入项目后的目录结构

将组件文件夹放入相应的目录就可以使用了
#在frontend/views/posts/create.php 使用,将之前的from表单的tags直接替换掉
<?= $form->field($model,'tags')->widget('common\widgets\tags\TagWidget');?>
tag的css样式
.select2-container--default .select2-selection--multiple {
background-color: white;
border: 1px solid #aaa;
cursor: text;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
border: 1px solid #2b542c;
outline: 0 none;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #5cb85c;
color:#fff;
}
