js中如何vuejs 加载html页面内容 – 在路上

订阅你的位置: >
> 【基本解决】KindEditor中加载已有html页面内容
【背景】之前已经实现了,整合KindEditor进来,可以正常使用了。现在需要在富文本编辑器KindEditor中,加载已有的html网页的内容。 【折腾过程】1.自己瞎写的,但是估计不能工作:&script&
function editSavedGoodsContent()
var kindeditor = window.
// 加载之前已保存的页面的HTML内容
html = kindeditor.html(&../previous_saved_page.html&);
console.log(html);
function submitGoodsContent()
var kindeditor = window.
// 取得HTML内容
html = kindeditor.html();
console.log(html);
&div class=&easyui-panel& style =&height: 100%;& title=&编辑商品&&
&p&商品名:&input type=&text& value=&新产品名1& id=&goodsName& name=&goodsName&/&&/p&
&textarea name=&easyui_editor& id=&easyui_editor& class=&easyui-kindeditor& style=&width: 100%; height: 200 &&在此输入新产品的介绍内容&/textarea&
&button onclick=&editSavedGoodsContent()&&编辑已保存的页面&/button&
&button onclick=&submitGoodsContent()&&提交当前页面&/button&
&/div&2.搜:KindEditor 加载html参考:感觉问题转换为: 【总结】最终是以变通的方式:通过KindEditor中,调用js的FileReader的方式去加载本地html文件,然后赋值给KindEditor的。相关代码为:&script&
function readSingleFile(e) {
var file = e.target.files[0];
if (!file) {
var reader = new FileReader();
reader.onload = function(e) {
var contents = reader.
displayContents(contents);
reader.readAsText(file);
function displayContents(contents) {
var kindeditor = window.
kindeditor.html(contents);
document.getElementById('editSavedGoodsContent')
.addEventListener('change', readSingleFile, false);
function submitGoodsContent()
var kindeditor = window.
// 取得HTML内容
html = kindeditor.html();
console.log(html);
&div class=&easyui-panel& style =&height: 100%;& title=&编辑商品&&
&p&商品名:&input type=&text& value=&新产品名1& id=&goodsName& name=&goodsName&/&&/p&
&textarea name=&easyui_editor& id=&easyui_editor& class=&easyui-kindeditor& style=&width: 100%; height: 200 &&在此输入新产品的介绍内容&/textarea&
&input type=&file& id=&editSavedGoodsContent& /&
&button onclick=&submitGoodsContent()&&提交当前页面&/button&
&/div&点击按钮,选择要加载的html,即可加载对应html内容。转载请注明: & 与本文相关的文章
13 queries in 0.260 seconds, using 10.29MB memory订阅你的位置: >
> 【已解决】设置HTML中的checkbox默认为选中的状态
【问题】写好了checkbox的html代码了,默认情况下,所有checkbox都是没有选中的,想要实现某个checkbox,默认为选中状态。【解决过程】1.参考,把原先代码:&input type=&checkbox& id=&retainQuestion&&保留问号&/input&改为:&input type=&checkbox& id=&retainQuestion& checked&保留问号&/input&即可实现默认选中该checkbox。详细HTML源码可以去看: 后来经过测试,其实只要保证有checked这个属性即可,即:其他的写法,比如有人说的:checked=&checked& 也是可以的。checked=&1& 也是可以的,甚至checked=&0&,都是可以的。 关于HTML的checkbox的更多内容可参考:转载请注明: & 与本文相关的文章
13 queries in 0.196 seconds, using 10.28MB memory订阅你的位置: >
> 【规避解决】KindEditor第二次加载时无法加载已有html内容
【问题】使用如下代码:test.html&html&
&title&商家管理系统&/title&
&meta http-equiv=&Content-Type& content=&text/ charset=UTF-8& /&
&link rel=&stylesheet& type=&text/css& href=&lib/easyui/themes/bootstrap/easyui.css&&
&link rel=&stylesheet& type=&text/css& href=&lib/easyui/themes/icon.css&&
&script type=&text/javascript& src=&lib/easyui/jquery.min.js&&&/script&
&script type=&text/javascript& src=&lib/easyui/jquery.easyui.min.js&&&/script&
&style type=&text/css&&
height:100%;
$(function(){
$('#test').bind('click', function(){
createWindow('#content', '添加团购描述',
700, 500, 'goodsdetaileditform.html');
function createWindow(contextId, title, width, height, url){
var cur_open_windowId = '#testwin';
$(contextId).empty();
$(contextId).append('&div id=&testwin& style=&text-align:margin:0 vertical-align: display: table- &&&/div&');
$(cur_open_windowId).window({
width:width,
height:height,
collapsible:false,
minimizable:false,
maximizable:false,
title:title,
cache: false,
modal:true
$(cur_open_windowId).window('refresh', url);
&a id=&test& class=&easyui-linkbutton& style=&width:183 margin:3px 5 margin-top:6&&发布商品&/a&
&div id=&content&&&/div&
&/html&和goodsdetaileditform.html &script type=&text/javascript& charset=&utf-8& src=&lib/kindeditor/kindeditor-all.js&&&/script&
&script type=&text/javascript& charset=&utf-8& src=&lib/kindeditor/lang/zh_CN.js&&&/script&
&script type=&text/javascript& charset=&utf-8& src=&lib/kindeditor/ekindeditor.js&&&/script&
&div class=&easyui-panel& border=0 &
&div style=&height: 100%;
margin: 0 overflow:&&
&form id=&ff& method=&post& title=&test& border=0 enctype=&multipart/form-data&&
&table cellpadding=&1& border=0&
&input type=&hidden& readOnly=true id=&goodsId& name=&goodsId& /&
&textarea name=&easyui_editor& id=&easyui_editor& class=&easyui-kindeditor& border=0 style=&width: 100%; height: 450
overflow:&&&/textarea&
&div style=&text-align:padding-bottom: 10&&
&a href=&javascript:void(0)& class=&easyui-linkbutton& style=&width: 100& onclick=&submitForm()&&提交&/a&
&a href=&javascript:void(0)& class=&easyui-linkbutton& style=&width: 100& onclick=&$('#testwin').window('close')&&关闭&/a&
var testcontent = &ceshi&;
$(function(){
setTimeout(initForm,50);
function initForm(){
var kindeditor = window.
kindeditor.html(testcontent);
kindeditor.sync();
function submitForm(){
&/script&然后测试结果是:第一次点击后:可以加载kindeditor,并且显示加载进来的html的内容:第二次再点击团购编辑,结果,虽然可以load进来kindeditor,但是html内容却无法加载了: 【折腾过程】1.怀疑可能是ajax加载html的问题,所以直接给要加载的内容赋值为固定的值: $(function(){
setTimeout(initForm,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
kindeditor.html(cur_goods_description);
kindeditor.sync();
};结果:问题依旧:第一次正常加载,第二次kindeditor可以显示,但是无法加载html内容。2.看着感觉像是initForm只执行了一遍,所以第二次再去点击后,结果没有执行对应的initForm,所以无法加载html内容。此处的相关代码运行逻辑是:点击修改时,调用的是:{
id:'editGoodsDesc',
text:'修改团购描述',
disabled:true,
iconCls: 'icon-edit',
handler: function(){
var row = $(contextId).datagrid('getSelected');
cur_goodsId = row.
cur_goods_description = row.
createWindow(contextId, '修改团购描述',
700, 500, 'view/store/form/goodsdetaileditform.html');
}goodsdetaileditform.html再去调用 $(function(){
setTimeout(initForm,50);
});延迟加载了: function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
kindeditor.html(cur_goods_description);
kindeditor.sync();
};3.搜:createWindow js run oncejsp createWindow  second time js not run参考:好好看看学学逻辑。4.搜:js createWindow  setTimeout run once参考:去换成setInterval试试:先去研究setInterval:搜:js setInterval参考:很明显,需要手动的调用clearInterval去清除掉。 去试试: $(function(){
// setTimeout(initForm,50);
setInterval(initForm,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
kindeditor.html(cur_goods_description);
kindeditor.sync();
};结果:问题依旧。5.去换成: $(function(){
setInterval(&initForm()&,50);
});试试:问题依旧。6.试试:
var kindeditor = window.
$(function(){
setInterval(&initForm()&,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
kindeditor.html(cur_goods_description);
kindeditor.sync();
};结果:第一次都无法加载html内容。7.加上调试代码试试: $(function(){
alert(&Into second page function&);
setInterval(&initForm()&,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
kindeditor.html(cur_goods_description);
kindeditor.sync();
};结果:第二次也是可以进入alert的-&说明此处的函数的确在新加载时是可以被执行到的。但就是第二次kindeditor无法加载html内容了。8.再去调试第二次能否获得对应的kindeditor的句柄: $(function(){
// alert(&Into second page function&);
// setTimeout(initForm,50);
// setInterval(initForm,50);
setInterval(&initForm()&,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
alert(kindeditor);
kindeditor.html(cur_goods_description);
kindeditor.sync();
};结果:一直刷新显示:说明了此处的setInterval是工作的。9.换成setTimeout: $(function(){
// alert(&Into second page function&);
setTimeout(initForm,50);
// setInterval(initForm,50);
// setInterval(&initForm()&,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
alert(kindeditor);
kindeditor.html(cur_goods_description);
kindeditor.sync();
};结果:第二次也是可以像上面一样,弹出[object Object]的提示的:说明第二次也是可以获得kindeditor的句柄的。但是为何设置html值,却无法显示?10.去给对应的ekindeditor.js加上调试代码,看看之前加的afterChange是否生效:
afterChange:function(){
this.sync();//这个是必须的,如果你要覆盖afterChange事件的话,请记得最好把这句加上.
alert(&KindEditor sync after change take effect&);
}和: $(function(){
// alert(&Into second page function&);
setTimeout(initForm,50);
// setInterval(initForm,50);
// setInterval(&initForm()&,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
alert(kindeditor);
kindeditor.html(cur_goods_description);
//kindeditor.sync();
};结果:第二次是生效的:11.去看看kindeditor是否有什么特殊参数设置,使得第二次加载的内容不显示。没找到。12.搜:kindeditor 第二次不加载参考:和我遇到同样的问题:“前台页面通过easyui当中的datagrid进行数据显示,当选中一行数据时点击编辑或者查看按钮,将该行数据显示到kindeditor当中,点击第一次正常加载,第二次加载时,不显示数据,”但是没人解决。提到有个autopostback,去找找看这个参数的含义。搜:autopostback参考:此处并没有发现此项目的文件哪里设置了AutoPostBack。13.参考:看到有个:afterBlur: function(){this.sync();},//和DWZ 的 Ajax onsubmit 冲突,提交表单时 编辑器失去焦点执行填充内容去查查这个afterBlur,以及其他类似的函数,找到了官网的解释:设置编辑器创建后执行的回调函数。数据类型: Function默认值: 无编辑器内容发生变化后执行的回调函数。数据类型: Function默认值: 无按下TAB键后执行的的回调函数。数据类型: Function默认值: 插入4个空格的函数编辑器聚焦(focus)时执行的回调函数。数据类型: Function默认值: 无编辑器失去焦点(blur)时执行的回调函数。数据类型: Function默认值: 无14.搜:kindeditor 第二次参考:试试:
afterChange:function(){
this.sync();//这个是必须的,如果你要覆盖afterChange事件的话,请记得最好把这句加上.
alert(&KindEditor sync afterChange&);
afterBlur : function(){
this.sync(); //编辑器失去焦点时直接同步,可以取到值
alert(&KindEditor sync afterBlur&);
}结果:问题依旧。15.看到:好像问题一样:其也是用了datagrid,结果没人回答。而且还是Kindeditor的官方。。。不过参考其办法,其实也去调试,看看当时第二次设置的html值是否正常: $(function(){
// alert(&Into second page function&);
setTimeout(initForm,50);
// setInterval(initForm,50);
// setInterval(&initForm()&,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
alert(kindeditor);
kindeditor.html(cur_goods_description);
alert(kindeditor.html());
//kindeditor.sync();
};结果:第二次也是可以正确获得kindeditor的html的值:的,但是结果就是没有刷新显示。看来的确就是KindEditor的bug了啊。。。16.去看看KindEditor中是否有函数可以重新创建编辑器的,或者refresh之类的。没找到,但去试试show(): $(function(){
setTimeout(initForm,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
alert(kindeditor);
kindeditor.html(cur_goods_description);
kindeditor.show();
alert(kindeditor.html());
};结果:问题依旧。17.再去试试blur和sync: $(function(){
setTimeout(initForm,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
alert(kindeditor);
kindeditor.html(cur_goods_description);
kindeditor.show();
alert(kindeditor.html());
kindeditor.sync();
kindeditor.blur();
kindeditor.focus();
};结果:离开焦点或获得焦点是可以正常执行。但是问题依旧,第二次还是不显示html的内容。18.难道实在不行,需要我去调试KindEditor的js??那可是太多的js代码, 很难看懂啊。。。19.把filterMode设置为false试试: $.fn.kindeditor.defaults = {
filterMode : false,
resizeType : 1,
allowPreviewEmoticons : false,结果:问题依旧。20.去试试别的方式设置html的值:结果发现:中的,都只是get html的值,而不是set html的:html=document.getElementById('editor_id').// 原生API
html=K('#editor_id').val();// KindEditor Node API
html=$('#editor_id').val();// jQuery所以没法试。21.算了,去换用另外一种办法:把之前用createWindow弹出编辑页面的事情,换成新打开html页面,看看能否绕过KindEditor的bug。22.不过上面方法还没折腾完,看到:想办法是去试试,则新创建出来的window关闭时,加上onDestroy然后也看到这里说了这个事情:去试试: $(function(){
// alert(&Into second page function&);
setTimeout(initForm,50);
function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.
alert(kindeditor);
if(kindeditor != null){
kindeditor.remove();
kindeditor = kindeditor.create();
kindeditor.html(cur_goods_description);
kindeditor.show();
alert(kindeditor.html());
};结果:没用。23.先去搞懂createWindow的用法和关闭对应的事件:24.然后就可以去添加对应的代码,在窗口销毁,关闭的时候,销毁KindEditor:参考:结果:创建窗口时不变:
$(cur_open_windowId).window({
width:width,
height:height,
collapsible:false,
minimizable:false,
maximizable:false,
title:title,
cache: false,
modal:true
$(cur_open_windowId).window('refresh', url);打开窗口时内部处理:
var kindeditor = window.
alert(&Into script, cur_open_windowId=& + cur_open_windowId);
$(cur_open_windowId).window({
onBeforeDestroy: function () {
alert(&onBeforeDestroy, window.editor=& + window.editor);
//window.editor.remove('textarea[name=&htmlcontent&]');
//当窗口关闭前销毁KindEditor
window.editor.remove();
//当窗口关闭前销毁KindEditor
&/script& 结果没用。25.初始化就设置:
$(cur_open_windowId).window({
width:width,
height:height,
collapsible:false,
minimizable:false,
maximizable:false,
title:title,
cache: false,
modal:true,
onBeforeClose: function () {
alert(&onBeforeClose, window.editor=& + window.editor);
window.editor.remove();
//当窗口关闭前销毁KindEditor
$(cur_open_windowId).window('refresh', url);之后不用:
var kindeditor = window.
alert(&Into script, cur_open_windowId=& + cur_open_windowId);
$(cur_open_windowId).window({
onBeforeDestroy: function () {
alert(&onBeforeDestroy, window.editor=& + window.editor);
window.editor.remove();
//当窗口关闭前销毁KindEditor
&/script& 结果还是不行。26.重新销毁后重建: function initForm(){
cur_goods_description = &pure fixed html content test&;
var kindeditor = window.editor.remove().create();
alert(&remove and recreate kindeditor: kindeditor=& + kindeditor);
kindeditor.html(cur_goods_description);
};还是不行。27.试试:
var kindeditor = window.editor.create();
alert(&recreate kindeditor: kindeditor=& + kindeditor);结果:还是不行。28.试试:$(cur_open_windowId).window({
width:width,
height:height,
collapsible:false,
minimizable:false,
maximizable:false,
title:title,
cache: false,
modal:true,
onBeforeClose: function () {
alert(&onBeforeClose, window.editor=& + window.editor);
window.editor.remove();
//当窗口关闭前销毁KindEditor
onBeforeDestroy: function () {
alert(&onBeforeDestroy, window.editor=& + window.editor);
window.editor.remove();
//当窗口关闭前销毁KindEditor
$(cur_open_windowId).window('refresh', url);结果:还是不行。 此处变成:即使最后在Window销毁destroy之前去remove销毁KindEditor,也还是无法绕过这个KindEditor的bug。暂时放弃使用这种办法了。 29.继续去弄: 【总结】最后是通过新打开HTML网页,实现规避KindEditor的bug,保证每次点击信息编辑页面后,可以正常打开页面,加载KindEditor,加载和显示商品信息。转载请注明: & 与本文相关的文章
15 queries in 0.239 seconds, using 10.40MB memory周游加拿大_期-周游加拿大 我们一起在路上-旅游-高清正版视频-爱奇艺
更多频道内容在这里查看
爱奇艺用户将能永久保存播放记录
过滤短视频
暂无长视频(电视剧、纪录片、动漫、综艺、电影)播放记录,
按住视频可进行拖动
&正在加载...
请选择打赏金额:
{{ each data as item index}}
{{ each data as item index}}
{{if item.isLast}}
&正在加载...
{{ each data as item index}}
{{item.playcount}}
&正在加载...
举报视频:
举报原因(必填):
请说明举报原因(300字以内):
请输入您的反馈
举报理由需要输入300字以内
感谢您的反馈~
请勿重复举报~
请刷新重试~
收藏成功,可进入查看所有收藏列表
把视频贴到Blog或BBS
当前浏览器仅支持手动复制代码
视频地址:
flash地址:
html代码:
通用代码:
通用代码可同时支持电脑和移动设备的分享播放
方式1:用手机看
用爱奇艺APP或微信扫一扫,在手机上继续观看
当前播放时间:
方式2:一键下载至手机
限爱奇艺安卓6.0以上版本
使用微信扫一扫,扫描左侧二维码,下载爱奇艺移动APP
其他安装方式:手机浏览器输入短链接//71.am/udn
下载安装包到本机:&&
设备搜寻中...
请确保您要连接的设备(仅限安卓)登录了同一爱奇艺账号 且安装并开启不低于V6.0以上版本的爱奇艺客户端
连接失败!
请确保您要连接的设备(仅限安卓)登录了同一爱奇艺账号 且安装并开启不低于V6.0以上版本的爱奇艺客户端
部安卓(Android)设备,请点击进行选择
请您在手机端下载爱奇艺移动APP(仅支持安卓客户端)
使用微信扫一扫,下载爱奇艺移动APP
其他安装方式:手机浏览器输入短链接http://71.am/udn
下载安装包到本机:&&
爱奇艺云推送
请您在手机端登录爱奇艺移动APP(仅支持安卓客户端)
使用微信扫一扫,下载爱奇艺移动APP
180秒后更新
打开爱奇艺移动APP,点击“我的-扫一扫”,扫描左侧二维码进行登录
没有安装爱奇艺视频最新客户端?
正在检测客户端...
您尚未安装客户端,正在为您下载...安装完成后点击按钮即可下载
30秒后自动关闭
:周游加拿大 - 2016我们一起在路上
请选择打赏金额:
播放量12.7万
播放量数据:快去看看谁在和你一起看视频吧~
更多数据:
{{each data}}
抱歉,没有“{{feature}}”的其他视频了.
&正在加载...
&正在加载...
&正在加载...
&正在加载...
&正在加载...
&正在加载...
{{ each data as item index}}
Copyright (C) 2018
All Rights Reserved
您使用浏览器不支持直接复制的功能,建议您使用Ctrl+C或右键全选进行地址复制
正在为您下载爱奇艺客户端安装后即可快速下载海量视频
正在为您下载爱奇艺客户端安装后即可免费观看1080P视频
&li data-elem="tabtitle" data-seq="{{seq}}"&
&a href="javascript:void(0);"&
&span>{{start}}-{{end}}&/span&
&li data-downloadSelect-elem="item" data-downloadSelect-selected="false" data-downloadSelect-tvid="{{tvid}}"&
&a href="javascript:void(0);"&{{pd}}&/a&
选择您要下载的《》剧集:
您使用浏览器不支持直接复制的功能,建议您使用Ctrl+C或右键全选进行地址复制订阅你的位置: >
> 【todo】分析百度空间插入歌曲后,所对应的html源码,以实现解析替换成wordpress所需要的外链歌曲的html源码
【todo】分析百度空间插入歌曲后,所对应的html源码,以实现解析替换成wordpress所需要的外链歌曲的html源码对应的百度帖子:歌曲的链接是从这里:找到的,此刻最新的是:然后去编辑帖子,插入歌曲,信息如下:音乐地址:歌手名:Kahlil Rhodes歌曲名:Droemmepige选择了 循环播放,没选 自动播放生成的html源码为:&&strong&& 试听:& &img name=”FCK_MP3_MUSIC” src=”” width=+ height=+ rel=”url%3Dhttp%3A%2F%2Fmf.songtaste.com%2F%2Fb8c7eb62f160c46e19a31ca7eFf%2Fff%2Ffff21151accec.mp3%26name%3DDroemmepige%26artist%3DKahlil%20Rhodes%26extra%3D%26autoPlay%3Dfalse%26loop%3Dtrue” /&&&/strong&去Python IDEL中试了试:&&&&&&&&&&&& &&& urllib.unquote(“url%3Dhttp%3A%2F%2Fmf.songtaste.com%2F%2Fb8c7eb62f160c46e19a31ca7eFf%2Fff%2Ffff21151accec.mp3%26name%3DDroemmepige%26artist%3DKahlil%20Rhodes%26extra%3D%26autoPlay%3Dfalse%26loop%3Dtrue”)‘url=http://mf.songtaste.com//b8c7eb62f160c46e19a31ca7e2479494/f/ff/fff21151accec.mp3&name=Droemmepige&artist=Kahlil Rhodes&extra=&autoPlay=false&loop=true’可以看到结果是:url=http://mf.songtaste.com//b8c7eb62f160c46e19a31ca7e2479494/f/ff/fff21151accec.mp3&name=Droemmepige&artist=Kahlil Rhodes&extra=&autoPlay=false&loop=true剩下的,就可以根据自己需要而去用代码处理了。注:这里有介绍该脚本存在漏洞:转载请注明: & 与本文相关的文章
13 queries in 0.273 seconds, using 10.31MB memory

我要回帖

更多关于 html css js 加载顺序 的文章

 

随机推荐