我试着创建一个Window
,它将显示AddToAny share buttons。我需要在此窗口下设置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>