调用select2跪了。。。 [ 2.0 版本 ]
好尴尬呐,跟着教程走,就一直不出来效果
view层的代码:
<?php
use kartik\select2\Select2;
use yii\web\JsExpression;
$this->title = 'test';
echo Select2::widget([
'name' => 'state_2',
'value' => '宋体',
'data' => array(
'' => '默认字体',
'宋体' => '宋体',
'黑体' => '黑体',
'楷体' => '楷体',
'隶书' => '隶书',
'幼圆' => '幼圆',
'Arial' => 'Arial',
'Courier New' => 'Courier New',
'Fixedsys' => 'Fixedsys',
'Georgia' => 'Georgia',
'Tahoma' => 'Tahoma',
'Verdana' => 'Verdana',
),
'options' => ['multiple' => true, 'placeholder' => 'Select states ...']
]);
?>
controller层的代码:
<?php
namespace frontend\controllers;
class ContactController extends \yii\web\Controller
{
public function actionIndex()
{
return $this->render('test' );
}
}
就这样了。。。select2是跟着教程安装完了,也不会报错,但效果就是这样的:
实在不懂为啥出这错,求大神解答。。。
xiam 补充于 2017-01-03 17:59
走过路过,看到的大神不要错过呐。。求大神解答一波~
共 3 个回答
xiam
注册时间:2016-05-01
最后登录:2017-01-04
在线时长:2小时27分
最后登录:2017-01-04
在线时长:2小时27分
- 粉丝0
- 金钱10
- 威望0
- 积分30