3

我有一个示例 sencha 触摸应用程序,试图实现电子邮件、呼叫和 SMS 功能,但是在运行应用程序时它没有打开电子邮件窗口或呼叫窗口。请问我能知道正确的语法来使它工作吗?

示例代码:

Ext.define('Sample.view.ContactsView', {
  extend:'Ext.Panel',
  requires:[
    'Ext.form.FieldSet',
    'Ext.field.Text'
  ],

  alias:"widget.contactpage",
  initialize:function () {
    this.callParent(arguments);
  },

  config:{
    items:[
      {
        xtype:'titlebar',
        title:'Contact Us'
      },
      {
        xtype:'panel',
        layout:'hbox',

        items:[
          {
            xtype:'button',
            flex:1,
            id:'smsButton',
            handler:function(){
              document.location.href = 'sms:464646'
            }
          },
          {
            xtype:'spacer'
          },
          {
            xtype:'button',
            text: 'Phone',
            id:'callMeButton',
            flex:1,
            handler:function(){
              document.location.href = 'tel:+1-800-555-1234'
            }
          }
        ]
      },
      {
        xtype:'button',
        text:'Email',
        id: 'emailButton',
        handler:function(){
          document.location.href = 'mailto:webmaster@example.com'
        }
      }
    ]
  },
});
4

2 回答 2

7

使用 window.open() 方法。

window.open('tel:+1-800-555-1234');
window.open('mailto:webmaster@example.com');
于 2012-05-30T12:13:43.497 回答
0

你可以通过使用<a>标签来做到这一点

对于电话号码

<a href="tel:+1-800-555-1234">+1-800-555-1234</a>

对于电子邮件

<a href="mailto:webmaster@example.com">webmaster@example.com</a>

点击链接将自动召唤安卓和 iOS 中的电话应用程序或电子邮件应用程序。

于 2014-12-11T06:42:11.683 回答