Sencha Touch:设置自动加载以包含 html 文件
我在 Sencha Touch 中设置了一个带有 2 个选项卡的简单面板:
ToolbarDemo.views.Homecard = Ext.extend(Ext.TabPanel, {
title: "home",
iconCls: "home",
defaults: {
styleHtmlContent: true
},
items: [{
title: 'Playlist',
scroll: 'vertical',
html: 'test'
},{
title: 'Comments',
scroll: 'vertical',
autoLoad: {url: 'disqus.html', scripts: true}
}]
});
Ext.reg('homecard', ToolbarDemo.views.Homecard);
在“注释”选项卡上,我尝试包含一个 disqus.html 文件,该文件与我的应用程序的 index.html 文件处于同一级别,但没有显示任何内容向上。通过谷歌搜索,我似乎已经正确输入了自动加载代码,但也许我错过了另一个步骤?
有人可以帮助我吗?
谢谢,
Nick
Disqus 代码:
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'monthlymixup'; // required: replace example with your forum shortname
// The following are highly recommended additional parameters. Remove the slashes in front to use.
var disqus_identifier = 'test';
// var disqus_url = 'http://example.com/permalink-to-page.html';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
I have set up a simple panel in Sencha Touch with 2 tabs:
ToolbarDemo.views.Homecard = Ext.extend(Ext.TabPanel, {
title: "home",
iconCls: "home",
defaults: {
styleHtmlContent: true
},
items: [{
title: 'Playlist',
scroll: 'vertical',
html: 'test'
},{
title: 'Comments',
scroll: 'vertical',
autoLoad: {url: 'disqus.html', scripts: true}
}]
});
Ext.reg('homecard', ToolbarDemo.views.Homecard);
On the 'Comments' tab I am trying to include a disqus.html file which is at the same level as the index.html file for my app, but nothing is showing up. From googling about it would seem that I have entered the autoload code correctly, but perhaps I have missed out another step?
Could someone help me on my way?
Thanks,
Nick
Disqus code:
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'monthlymixup'; // required: replace example with your forum shortname
// The following are highly recommended additional parameters. Remove the slashes in front to use.
var disqus_identifier = 'test';
// var disqus_url = 'http://example.com/permalink-to-page.html';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“autoLoad”属性仅在 ext.js 中存在,在 sencha-touch 中尚不可用。
但你可以这样做(你的里程会有所不同):(
disqus.html)
The "autoLoad" property is only in ext.js and not yet available in sencha-touch.
But you can do something like this (Your mileage WILL vary):
(disqus.html)
我想带一段用于获取外部 html 的代码。正如您可能注意到的,您应该使用回调,而不是成功函数。不知道为什么,通常结果会导致功能失败。
I'd like to bring a piece of code that I use to get an external html. As you may note, you should use callback, instead of success function. Not sure why, often the result goes to failure function.