![](/img/trans.png)
[英]How to create a modal window which only masks a particular component in ExtJs 4?
[英]ExtJS: How to load additional script on a specific `Window` component?
我正在嘗試創建一個Window
,它將顯示AddToAny 共享按鈕。 我需要在此窗口下設置AddToAny所需的script
。 我在社交媒體按鈕中搜索了類似的問題。
Mashup
類可以工作。 我創建了一個mixin
類,但不幸的是這不起作用。html
配置調用它,但這也不起作用。我怎樣才能達到我的目標?
//Here is related function.
onMoreShare: function () {
new Ext.window.Window({
// requires: ['MyApp.mixins.ShareApps'], //Tried to load JS file to Window
title: 'More...',
autoShow: true,
modal: true,
padding: 20,
html: '<a class="a2a_dd" href="https://www.addtoany.com/share"><img src="https://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"></a>\n' +
// Mixin didn't work; tried original code...
// '<script async src="https://static.addtoany.com/menu/page.js"></script>\n' +
// Mixin didn't work; tried to call js file through project
//'<script type="text/javascript" src="../../../resources/js/addToAny.js"></script>\n'
});
}
//Created this `Mashup` based class to load related JS file.
Ext.define('MyApp.mixins.ShareApps', {
mixins: ['Ext.mixin.Mashup'],
requiredScripts: [
'//static.addtoany.com/menu/page.js'
]
});
看看這個小提琴:
Ext.application({
name : 'Fiddle',
launch : function() {
Ext.widget('window', {
width: 300,
height: 250,
padding: 5,
title: 'Hello World',
html: '<div class="a2a_kit a2a_kit_size_32 a2a_default_style"> '+
'<a class="a2a_dd" href="https://www.addtoany.com/share"></a> '+
'<a class="a2a_button_facebook"></a> '+
'<a class="a2a_button_twitter"></a> '+
'<a class="a2a_button_google_plus"></a> '+
'</div>'
}).show();
}
});
索引頁面:
<html>
<head>
<script async src="https://static.addtoany.com/menu/page.js"></script>
</head>
</html>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.