使用ActionSheet的Sencha触摸 [英] sencha-touch using ActionSheet

查看:15
本文介绍了使用ActionSheet的Sencha触摸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ActionSheet向用户显示几个选项以继续。我想在屏幕中间添加一个简单的文本框来向用户描述问题。
有没有一种简单/标准的方法在Sencha-Touch中添加这样的提示?

推荐答案

您需要在覆盖图上执行类似的操作...

if (!this.popup) {
  this.popup = new Ext.Panel({
    hideOnMaskTap: false,
    floating: true,
    modal: true,
    centered: true,
    hideOnMaskTap: false,
    width: 300,
    height: 200,
    styleHtmlContent: true,
    scroll: 'vertical',
    html: '<p>msg here</p>'
  });
}
this.popup.show('pop');
这里的关键是hideOnMaskTap: false,这将防止当您在其遮罩区域中单击时覆盖消失。

然后您可以显示动作单,但您必须记住隐藏动作单按钮的处理程序中的覆盖,因为当您点击蒙版区域时,它将不再消失。

if (!this.actions) {
  this.actions = new Ext.ActionSheet({
    items: [{
      text: 'decline',
      ui: 'decline',
      handler: function() {
        this.doWhateverYouNeedToDo();
        this.actions.hide();
        this.popup.hide();
      }
    }, {
      text: 'save',
      handler: function() {
        this.doWhateverYouNeedToDo();
        this.actions.hide();
        this.popup.hide();
      }
    }, {
      text: 'cancel',
      scope: this,
      handler: function() {
        this.doWhateverYouNeedToDo();
        this.actions.hide();
        this.popup.hide();
      }
    }]
  });
}
this.actions.show();
请注意,在工作表处理程序中隐藏了覆盖。(我不会在上面这样做,但为了保持整齐,您很可能希望在隐藏覆盖和动作单后将其销毁)

这篇关于使用ActionSheet的Sencha触摸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆