我只是在Yii2应用程序中安装了2amigos CKEditor和日期选择器。安装成功,我将代码添加到表单中并刷新页面,但未显示CKEditor和日期选择器。 CKEditor显示为文本区域表单。
这是我的package.json:
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": ["yii2", "framework", "advanced", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-bootstrap": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0",
"2amigos/yii2-date-picker-widget": "~1.0",
"2amigos/yii2-date-time-picker-widget": "~1.0",
"kartik-v/yii2-helpers": "*",
"yiidoc/yii2-redactor": "*",
"mihaildev/yii2-ckeditor": "*",
"kartik-v/yii2-widget-sidenav": "*",
"2amigos/yii2-ckeditor-widget": "*"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.1.0",
"yiisoft/yii2-gii": "~2.1.0",
"yiisoft/yii2-faker": "~2.0.0",
"codeception/base": "^2.4.0",
"phpunit/phpunit": "~6.5.5",
"codeception/verify": "~1.0.0",
"symfony/browser-kit": ">=2.7 <=4.2.4"
},
"config": {
"process-timeout": 1800,
"fxp-asset": {
"enabled": false
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
这是我的表格:
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use dosamigos\ckeditor\CKEditor;
/* @var $this yii\web\View */
/* @var $model frontend\models\LayananM */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="layanan-m-form">
<?= $form->field($model, 'description')->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'basic'
]) ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
代码有什么问题?