gpt4 book ai didi

javascript - Extjs 抛出错误 "please verify that the file exists"

转载 作者:行者123 更新时间:2023-12-03 07:06:35 28 4
gpt4 key购买 nike

我开始学习 ExtJS,但加载 View 文件时遇到一些问题。当我刷新浏览器时,我的控制台中出现以下错误。

ext-dev.js:10454 GET http://bugtracker.com/app/views/Login.js?_dc=1461346272737 Ext.apply.injectScriptElement @ ext-dev.js:10454Ext.apply.loadScriptFile @ ext-dev.js:10577Ext.apply.require @ ext-dev.js:10769(anonymous function) @ ext-dev.js:11123Ext.apply.doProcess @ ext-dev.js:7453Ext.apply.process @ ext-dev.js:7442Ext.Class.ExtClass @ ext-dev.js:7359Ext.ClassManager.create @ ext-dev.js:8685Ext.apply.define @ ext-dev.js:9508(anonymous function) @ Application.js?_dc=1461346272723:1
ext-dev.js:10857 Uncaught Error: [Ext.Loader] Failed loading 'app/views/Login.js', please verify that the file exists

这是我的 Login.js Controller

Ext.define('BugTracker.controller.Login', {
extend: 'Ext.app.Controller',
views: ['Login'],
init: function(){
this.control({
'login form button#submit': {
click: this.onButtonClickLogin
},
'login form button#cancel': {
click: this.onButtonClickCancel
},
'login form': {
beforeaction: this.onFormBeforeAction
}
})
},

onButtonClickCancel: function (button, e, option) {
button.up('form').getForm().reset();
},

onButtonClickLogin: function (button, e, option) {
button.up('form').getForm().submit({
url: '/login',
failure: function(form, action){
switch (action, failureType){
case Ext.form.action.Action.CLIENT_INVALID:
Ext.Msg.alert('Failure', 'Invalid login details');
break;
case Ext.form.action.Action.SERVER_INVALID:
Ext.Msg.alert('Failure', action.result.msg);
break;
case Ext.form.action.Action.CONNECT_FAILURE:
Ext.Msg.alert('Failure', 'Server connection error');
break;
default:
Ext.Msg.alert('Error','An unknown error has occurred');
}
},
success: function(form, action){
user = Ext.create('BugTracker.model.User', action.result.user);
button.up('login').close();
Ext.create('BugTracker.view.Viewport');
}
})
}
});

这是我的 Login.js View

Ext.define('BugTracker.view.Login', {
extend: 'Ext.window.Window',
alias: 'widget.login',
autoShow: true,
height: 170,
width: 360,
layout: {
type: 'fit'
},
iconCls: 'key',
title: 'Login',
closeAction: 'hide',
closable: false,

items: [{
xtype: 'form',
frame: false,
bodyPadding: 15,
defaults: {
xtype: 'textfield',
anchor: '100%',
labelWidth: 60
},
items:[{
name: 'user',
fieldLabel: 'User'
},{
inputType: 'password',
name: 'password',
fieldLabel: 'Password'
}],
dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
items: [{
xtype: 'tbfill'
},{
xtype: 'button',
itemId: 'cancel',
iconCls: 'cancel',
text: 'Cancel'
},{
xtype: 'button',
itemId: 'submit',
iconCls: 'login',
text: 'Login'
}]
}]
}]
});

这是我的 Application.js

Ext.define('BugTracker.Application', {
name: 'BugTracker',

requires: ['BugTracker.views.Login'],

extend: 'Ext.app.Application',

views: [
// TODO: add views here
],

controllers: [
// TODO: add controllers here
],

stores: [
// TODO: add stores here
],

init: function () {
Ext.apply(Ext.data.validations, {
customPassword: function (val, field) {
return /^((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{8,50})/.test(val);
},
customPasswordText: 'Not a valid password. Length should be between 6 and 65 chars. Password should contain one digit, one lovercase letter and one uppercase letter' +
'and one special symbol (@#$%)'
});
},

launch: function(){
Ext.widget('login');
}
});

你能帮我看看我做错了什么吗?如果您需要任何其他信息,请告诉我,我会提供。谢谢

最佳答案

我发现我的问题出在哪里了。问题出在 Application.js 中,我需要 View 而不是 View !

Ext.define('BugTracker.Application', {
name: 'BugTracker',

requires: ['BugTracker.view.Login'],

extend: 'Ext.app.Application',
...

关于javascript - Extjs 抛出错误 "please verify that the file exists",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36800088/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com