[英]Sencha Touch 2: Google+ signin button in html
I'm trying to add google+ signin button to a Sencha Touch 2 application according to this documentation: https://developers.google.com/+/web/signin/add-button-javascript#step_4_add_a_google_sign-in_button_to_your_page 我正在尝试根据此文档将google +登录按钮添加到Sencha Touch 2应用程序中: https : //developers.google.com/+/web/signin/add-button-javascript#step_4_add_a_google_sign-in_button_to_your_page
My idea is to simply create a container and add this code (html and javascript) within the view like below: 我的想法是简单地创建一个容器,并在如下视图中添加此代码(html和javascript):
Ext.define('BrewersMoney.view.Main', {
extend: 'Ext.Container',
xtype: 'main',
config: {
layout: {
type: 'hbox',
align: 'middle'
},
html: '<meta name="google-signin-cli............'
}
});
But this code does not work. 但是此代码不起作用。 Any ideas how I can add the code from the google documentation in order to get the get the google+ login button? 有什么想法我可以如何从Google文档中添加代码以获取Google+登录按钮?
Thanks a lot and regards, Peter 非常感谢您,彼得
Create a file with the script: 使用脚本创建文件:
<script type="text/javascript">
(function() {
var po = document.createElement('script');
po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js?onload=render';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
</script>
Then add a Ext.Button with the ID 'myButton'. 然后添加一个ID为“ myButton”的Ext.Button。
After that you need to call 之后,您需要致电
// Additional params
var additionalParams = {
'theme' : 'dark'
};
gapi.signin.render('myButton', additionalParams);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.