作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
你好,为了管理用户访问,我需要禁用加载一些项目,现在在视口(viewport)中我用“隐藏”属性隐藏它们,但我无法阻止这些项目的后台处理,例如服务器请求
如何禁用特定项目的加载。
这是我的视口(viewport)代码
var notAllowAdmin=true; //init access rule gere for admin panel
Ext.define('eFinances.view.Viewport', {
extend: 'Ext.container.Viewport',
requires: [
'Ext.layout.container.Border'
],
layout: 'border',
items: [
{
xtype: 'eFinancesToolbar',
region: 'north'
},
{
title: 'Navigation',
region: 'west',
collapsible: true,
split: true,
width: 200,
minWidth: 175,
maxWidth: 400,
animCollapse: true,
margins: '0 0 0 5',
layout: 'accordion',
items: [{
xtype:'menuTresorerie',
title: 'Trésoreries',
iconCls: 'balance' // see the HEAD section for style used
},{
xtype:'menuAchat',
title: 'Achat et fournisseurs',
iconCls: 'depense' // see the HEAD section for style used
}, {
xtype:'menuVente',
title: 'Ventes et clients',
iconCls: 'recette'
}, {
xtype:'menuAdmin',
hidden :notAllowAdmin, // hide items if not allowed
title: 'Administration',
iconCls: 'administration'
}]
},
{
region: 'center',
title: 'work area'
}
]
});
目前我隐藏管理面板,其中 notAllowAdmin 变量使用规则访问初始化,但整个后台进程都被执行,有些人可以告诉我如何继续完全禁用面板加载或给我最好的主意来做到这一点(管理用户访问)
问候
最佳答案
您可以停止向项目数组添加隐藏组件。示例:
items: [
{
xtype:'menuTresorerie',
title: 'Trésoreries',
iconCls: 'balance' // see the HEAD section for style used
},
{
xtype:'menuAchat',
title: 'Achat et fournisseurs',
iconCls: 'depense' // see the HEAD section for style used
},
{
xtype:'menuVente',
title: 'Ventes et clients',
iconCls: 'recette'
}
].concat(notAllowAdmin ? [] : [
{
xtype:'menuAdmin',
title: 'Administration',
iconCls: 'administration'
}
]);
但是您应该注意到,这应该仅被视为优化,真正的访问控制应该在服务器端实现。
关于javascript - 在视口(viewport)中有条件加载项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19951312/
我正在尝试获得一个按钮,按下该按钮时会改变颜色。当再次按下时,它应该变回原来的颜色。我究竟做错了什么? 我的模板中的按钮: export default { data: {
我是一名优秀的程序员,十分优秀!