- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用具有不同 Toast 的 Sencha Touch 应用程序来显示“成功”或“信息”等消息。但我有随机行为,例如:
1° 如果您使用 Toast 通过一个操作点击导航到应用程序,并且在 Toast 启动时导航到其他屏幕,则 Toast 会出现随机行为,获取最后一种颜色而不是更改..(在测试用例中具有相同的颜色)颜色但有不同的消息,请您阅读代码)
2° 有时 Toast 不会出现,我也没有解释。
关于代码有什么建议吗?目前它是一个单例类,根据操作从应用程序的其他部分/ Controller 调用。
另一方面,还有其他具有类似行为的方法吗?也许需要改变策略并且不使用Toasts..
它发生在 Windows 8 和 iOS 中,我使用的是 2.4.1 版本,阅读 2.4.2 的发行说明没有关于框架的这个元素的新闻,我猜与更新到最新框架无关版本。
这是我的 Toast Manager 类:
/**
* Loading popup as a static-functions class
*
* Different toast-messages colors:
* 0 --> green
* 1 --> orange
* 2 --> red
*
* We create a config object and depending of the status we show a Toast
*/
Ext.define('xx.view.components.ToastManager', {
singleton : true,
requires : [
'Ext.Toast'
],
config : {
toastOptions: {
message : '',
centered : false,
width : 200,
height : 100,
bottom : '10%',
modal : false,
right : 10,
style : '',
type : 'slide', duration: 850, easing: 'ease-out',
hideAnimation: {type: 'fadeOut', duration: 650, easing: 'ease-out'},
timeout : 3000
},
toastComponent : null,
t : null
},
constructor : function () {
this.initConfig();
},
changeVisibility: function() {
if(this.getT()) {
clearTimeout(this.getT());
}
var toastes = Ext.query('.x-toast');
for(var i = 0; i < toastes.length; i++) {
Ext.get(toastes[i]).setStyle('visibility', 'visible');
}
var t = setTimeout(function() {
var toastes = Ext.query('.x-toast');
for(var i = 0; i < toastes.length; i++) {
Ext.get(toastes[i]).setStyle('visibility', 'hidden');
}
}, 4000);
this.setT(t);
},
/**
* Shows a successful message
* @param label
* @param status
*/
showToastMessage : function (label, status) {
var options = this.getToastOptions();
options.message = label;
switch (status) {
case 0:
options.style = 'background-color: #30B420';
break;
case 1:
options.style = 'background-color: #FFA500';
break;
case 2:
options.style = 'background-color: #ff0000';
break;
default:
options.message = "?"
}
this.changeVisibility();
this.setToastComponent(Ext.toast(this.getToastOptions()));
}
});
最佳答案
我正在使用这个函数来处理我的 toast 消息(尽管在 ExtJS 中):
showToastMessage: function(message, alignTo){
Ext.toast({
cls: 'toast-window',
header: false,
html : '<div class="toast">' + message + '</div>',
animate: true,
slideInAnimation: 'ease',
slideInDuration: 300,
slideOutDuration: 200,
autoCloseDelay: 1500,
align: alignTo ? alignTo : 't'
});
}
您可以将一些 CSS 应用于 toast-window
和 toast
类,以使您的消息看起来不错。
您只需将消息传递给此函数,它就会显示一个不错的 toast !
关于javascript - Sencha Touch 中的 Toast 实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38397928/
我有一个基于 的项目 Sencha 触控 v2.0.x ,我在 中处理它 Sencha 建筑师2.0 .现在我更新了 Sencha 建筑师至 2.1 并希望更新我的项目以使用 Sencha 触控 2.
我已经制作了我的应用程序,现在我想打包它,所以我转到包含以下内容的终端中的应用程序目录 /app /app.js /app.json /resources /index.html /touch 我运行
我已经制作了我的应用程序,现在我想打包它,所以我转到包含以下内容的终端中的应用程序目录 /app /app.js /app.json /resources /index.html /touch 我运行
大家好,我是 sencha 的新手,我试图找出 sencha architect/sencha touch 中的一些东西是如何工作的。 我找到了一个项目 http://miamicoder.com/2
有人可以给我写完整的代码来告诉我如何使用 sencha touch 1 淡入和淡出 html 元素吗?具体来说,我需要知道需要包含哪些 html、javascript 和 css 文件。 我一直试图获
我正在尝试使用 sencha touch 的列表分页插件。但是几乎没有关于如何使用它的好(或坏)文档,我很困惑。 当我激活列表中的插件时 this.myList = new Ext.List({
我想要一个水平旋转木马,每个面板的内容都可以垂直滚动。目前,内容在屏幕底部被截断,我无法向下滚动内容。我将此代码用于轮播: Pages.Portfolio = new Ext.Carousel({ t
我正在用sencha touch做一个项目,但我需要连接相机iPad来拍照。开发是通过网络进行的。请帮助我,我找不到解决方案。 谢谢。 最佳答案 如文档中所述:“Sencha Touch 使您能够快速
我是移动技术的新手。我想用Sencha touch创建我的个人投资组合。 我需要为此付费吗? 最佳答案 不,你不会的。我还是建议您使用商业许可证,因为它是免费的,并且对您的操作有较少的限制。您只需要付
我下载了sencha touch 并提取到一个文件夹中。 然后我下载了the sdk tool 并安装它。 使用windows 7 cmd,cd到sencha touch文件夹,然后运行sencha
我的移动应用程序目前在 Sencha Touch 1.1.1 下运行。现在,我想将其升级到 Sencha Touch 2.0。有人可以帮我做这件事吗?升级时我应该注意哪些一般步骤? 另外,是否有帮助该
我只是找不到解决方法,请帮助 我的 config.rb 位于 $PROJECT_HOME/assets/www/theming 位置 dir = File.dirname('..Path_to_pr
在他们的文档中找不到指定了所有日期时间格式的位置? 我想要一个日期看起来像这样 13 Jan 2013 我发现了这个模式: date("F j, Y") 但这给了我很长的月份名称。 (不知道为什么他们
我需要一个简单的嵌套 ListView 示例。沿着这条线的东西...... (来源:roosteronacid.com) 当您单击一个项目时,您将转换(滑动)到包含另一个列表的下一个 View /卡片
我有一个 sencha touch 显示在列表中的联系人列表。然后,当您单击列表中的姓名时,它应该向右滑动并说您好 {联系人姓名}!但是当它现在滑过时,它只是说你好!第 29 行是项目点击的 Acti
我是一名 Ext 老手,但我需要创建一些相当简单的移动应用程序,自然而然我正在研究 sencha touch。 Ting 是 - 大多数示例无法在 Firefox/Opera 中运行。 我很高兴使用
我有一个关于 xtypes 的问题。当我这样做时: // map var map = new Ext.map({ fullscreen: true, getLocation: true
我使用 sencha create app 命令创建了我的应用程序。它在我的机器上以及我们的 Web 服务器上都可以本地运行。我正在尝试构建用于生产的应用程序,但以下命令对我不起作用: sencha
只是想知道在 Sencha Touch 中是否有处理该问题的方法。一个商店,应用不同的过滤器后,商店可以用于不同的地方。 例如: 我有一家商店: Ext.regModel('abc', { f
我想使用 sencha touch 创建自定义工具栏。使用 Ext.Toolbar,我能够创建一个像样的屏幕标题栏。但我的要求是将我公司的品牌形象标志放在标题栏的中央,而不是下面代码提供的简单文本。
我是一名优秀的程序员,十分优秀!