Open hipig opened 5 years ago
是的,受限于 Laravel-admin
这里好像不是很容易判断是否为一对多,晚点我研究一下,欢迎 PR
是的,受限于
Laravel-admin
这里好像不是很容易判断是否为一对多,晚点我研究一下,欢迎 PR
貌似name是唯一的,是否可以把这个当做成id
@pigzzz123 可以使用 name ,但在一对多点击添加的时候还是有点问题
遇到这个问题,请问有什么解决方案么
@YKAEJ 暂时没有找到合适的解决办法,已经弃用了
@hipig @codingyu @YKAEJ 搞定了,但是改的是底层文件,不是很有友好的操作。
// vendor\codingyu\ueditor\src
$this->script = <<<EOT
var laKey = "{$this->elementName}";
window.UEDITOR_CONFIG.serverUrl = '{$laravel_ueditor_route}';
if (laKey == 'body[new___LA_KEY__][body]') {
laKey = 'body[new_'+index+'][body]';
}
console.log(laKey);
UE.delEditor(laKey);
var ue_{$jsId} = UE.getEditor(laKey, {$config});
ue_{$jsId}.ready(function() {
ue_{$jsId}.execCommand('serverparam', '_token', '$token');
});
EOT;
// vendor\codingyu\ueditor\resources\views\editor.blade.php
<div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<textarea id="{{$name}}" name="{{$name}}">{!! old($column, $value) !!}</textarea>
@include('admin::form.help-block')
</div>
</div>
查源码发现,编辑器是在id上加载的,而一对多内所有的name都是一样的,例如字段名为content,id则为content,所以所有的id也是一样,故只会渲染第一个id为name编辑器