HTML Ueditor加載空白問題


問題描述

  • Ueditor打開時加載不出內容

原因分析

  • Ueditor重復加載時,會存在緩存問題
  • Ueditor采用異步加載方式,所以數據獲取和賦值要寫在Ueditor異步回調里

解決方案

UE.delEditor('txtContent'); //先刪除之前Ueditor實例對象
var self = this;
var editor = UE.getEditor('txtContent', {
    toolbars: toolbar,
    initialFrameHeight: 600,//設置編輯器高度
    scaleEnabled: false//設置不自動調整高度
});
editor.addListener("ready", function () {
	self.editor = editor;
	//獲取數據
	$.ajax({
		type: "GET",
		url: "http://127.0.0.1/admin/news?id=1",
		success: function(result) {
			console.log(result);
			//self.editor.setContent(result.FDetail);
		}
	});
});

處理結果

  • Ueditor可以正常加載數據


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM