• laravel-admin联动选择展示时ueditor样式错乱


    问题

    录入内容时,根据资源类型,展示不同的需要录入的内容,很常见的功能,但是在切换时,编辑器一直出不来,如图:
    在这里插入图片描述

    代码如下:

      $form->radio('type', '资源类型')
                        ->when(2, function (Form $form) {
                            $form->ueditor('content', '文章内容');
                        })
                        ->when(1, function (Form $form) use (&$class) {
                            $form->ueditor('xianbingshi', '病例现病史');
                            $form->ueditor('jiazushi', '病例家族史');
                        })
                        ->options([1,2])
                        ->default(2);
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    解决方法

    感觉写法没问题,那我就开始看控制台,看样式,为啥没出来,发现了这个:
    在这里插入图片描述
    找到了原因,就好解决了,我本来是打算直接用js来改变宽度的,如下:

     $js = <<
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    但是一直没生效,后来发现,是找不到id为edui282的元素,因为是script类型的;后来发现能找到类**.edui-default .edui-editor**,干脆直接在ueditor.css中改了样式;

    .edui-default .edui-editor {
        border: 1px solid #d4d4d4;
        background-color: white;
        position: relative;
        overflow: visible;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        width: auto!important;//这个是加的
    }
    
    .edui-default .edui-editor-iframeholder {
        position: relative;
        width: auto !important;//这个是加的
        /*for fix ie6 toolbarmsg under iframe bug. relative -> static */
        /*_position: static !important;*
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    然后让其css生效就可以了

  • 相关阅读:
    【Logback】Logback 的配置文件
    Android Banner - ViewPager 02
    飞书机器人相关文档
    dubbo 核心源码分析
    nodejs事件循环机制
    浅谈Java内部锁synchronized
    Java 使用 Easyexcel 导出大量数据
    现代计算方法或可使潜艇狼群战术再现
    LaTeX公式编辑器ver1.6.5 编辑器 -----TeX公式编辑网站
    一款超好用的开源密码管理器?
  • 原文地址:https://blog.csdn.net/snow_love_xia/article/details/132887783