YII2.0 UEdit [ 2.0 版本 ]
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2015/12/7
* Time: 11:34
*/
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2015/12/6
* Time: 14:29
*/
use \kucha\ueditor\UEditor;
?>
<?php echo UEditor::widget([
'clientOptions' => [
//编辑区域大小
'initialFrameHeight' => '200',
//设置语言
'lang' =>'en', //中文为 zh-cn
//定制菜单
'toolbars' => [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|'
],
]
]
]);
?>
报错:Either 'name', or 'model' and 'attribute' properties must be specified.
谁能解救下,不太会用
共 3 个回答
-
shuliangfu 回答于 2015-12-09 02:01 举报
没有Model,和name属性吧,一般用在表单型里面,都有model和name属性的
<?= $form->field($model, 'content')->widget( \kucha\ueditor\UEditor::className(), [ //'name' => 'content', //'id' => 'Article[content]', //'attribute' => 'content', //'model' => $model, 'clientOptions' => [ //编辑区域大小 'initialFrameHeight' => '200', //设置语言 'lang' => 'zh-cn', //中文为 zh-cn 英文为 en 'zIndex' => 1500,
-
你必须要把 name 或者model和attribute 这些指定的属性添加进去
只填name一般只是用于文本提交
model和attribute就是提交修改文本<?= UEditor::widget([ 'model'=>$model, 'attribute'=>'post_content', 'options'=>['style'=>'height:400px;'] , 'clientOptions' => [ //编辑区域大小 'initialFrameHeight' => '200', //设置语言 'lang' =>'en', //中文为 zh-cn //定制菜单 'toolbars' => [ [ 'fullscreen', 'source', 'undo', 'redo', '|', 'fontsize', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', '|', 'lineheight', '|', 'indent', '|' ], ] ] ])?>
proee
注册时间:2015-12-01
最后登录:2016-06-20
在线时长:8小时3分
最后登录:2016-06-20
在线时长:8小时3分
- 粉丝1
- 金钱50
- 威望0
- 积分130