直接上代码,不废话
<div class="layui-form"> <div class="layui-form-item"> <label class="layui-form-label">内容</label> <script type="text/html" template lay-done='formRender(d)'> <div class="layui-input-block"> <textarea name="content" id="content" cols="30" rows="10"></textarea> </div> </script> </div> </div> <script> function formRender(data){ layui //extend部分请在index.html引入 //.extend({ // tinymce: '{/}./tinymce/tinymce' //}) .use(['tinymce'], function(){ var tinymce = layui.tinymce; if(window.TINY_Edit){ //判断编辑器是否已经创建过 window.TINY_Edit.destroy(); } window.TINY_Edit = tinymce.render({ elem: "#content" , height: 600 , width:'100%' }); }); } layui.use(['admin','util', 'table','form'], function(){ var admin = layui.admin ,table = layui.table ,form = layui.form; }); </script>