之前用到了Ueditor官网上面的ueditor for thinkphp 3.2插件,之后整合进自己的项目,在使用单独图片上传时发现了侦听事件不起作用。找了度娘,大家都有这个问题,去看了官方文档,最终解决了问题,分享给大家。
之前用到了Ueditor官网上面的ueditor for thinkphp 3.2插件,之后整合进自己的项目,在使用单独图片上传时发现了侦听事件不起作用。
找了度娘,大家都有这个问题,去看了官方文档,最终解决了问题,分享给大家。
先上问题截图
再上官方文档
SO,给多图上传模块加上例外就可以使用了。//---上传首图开始---<br>
var _editor;<br>
$(function() {<br>
//重新实例化一个编辑器,防止在上面的editor编辑器中显示上传的图片或者文件<br>
_editor = UE.getEditor('upload_ue', {<br>
serverUrl :'/Home/Index/ueditor.html',<br>
});<br>
_editor.ready(function () {<br>
//设置编辑器不可用<br>
_editor.setDisabled('insertimage'); <br>
//隐藏编辑器,因为不会用到这个编辑器实例,所以要隐藏<br>
_editor.hide();<br>
//侦听图片上传<br>
_editor.addListener('beforeInsertImage', function (t, arg) {<br>
$("#picture").attr("value", arg[0].src);<br>
//图片预览<br>
$(".form-post .pic-show").show();<br>
$("#preview").attr("src", arg[0].src);<br>
})<br>
});<br>
});
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool