문제

콘솔에서 오류가 발생합니다. generacodicicetagcode.내 Ext.application is not a function 파일에는이 코드가 들어 있습니다.

...
<link rel="stylesheet" type="text/css" href="/ext-5.0.1/packages/ext-theme-neptune/build/resources/ext-theme-neptune-all.css" />
<script src="/ext-5.0.1/ext-all-debug.js"></script>    
<script type="text/javascript" src="app.js"></script>    
...
.

index.html에는 한 데모에서 가져온이 코드가 있습니다.

Ext.application({
name: 'AM',
appFolder: 'app',
launch: function() {
    Ext.create('Ext.container.Viewport', {
        layout: 'fit',
        items: [{
                xtype: 'panel',
                title: 'Users',
                html : 'List of users will go here'
        }]
    });
}
});
.

편집

공식 "app.js를 실행 중에도 동일한 오류가 발생합니다.왜 그거야?

도움이 되었습니까?

해결책

Ext.application 블록 내부의 Ext.onReady로 호출을 래핑합니다.

// app.js
Ext.onReady(function() {
  Ext.application({
    name: 'AM',
    appFolder: 'app',
    launch: function() {
      Ext.create('Ext.container.Viewport', {
        layout: 'fit',
        items: [{
          xtype: 'panel',
          title: 'Users',
          html : 'List of users will go here'
        }]
      });
    }
  });
})
.

필수 이유는 BTW가 ext-all-debug.js 파일에 모든 ExtJS를 포함하지 않는다는 것입니다.부트 스트랩 코드 - 다른 모든 것을 얻는 방법을 알고있는 코드가 들어 있습니다."다른 모든 것"의 일부는 응용 프로그램 코드입니다.그래서 그럴 기회가있을 때까지 Ext.Application이 존재하지 않습니다.

PORTAL 예제는 sencha app build - microloader.js의 결과를 사용하기 때문에 언급합니다.이는 전체 버전의 Extjs (또는 앱에서 사용 된 부품)를로드하므로 Ext.Application은 이미 사용 된 시점에 의해 이미 정의되어 있습니다.(Sencha 바이올린과 동일하게 간다 - 당신은 Ext.onready가 필요하지 않습니다)

다른 팁

대신

<script src="/ext-5.0.1/ext-all-debug.js"></script>
.

를 사용해야합니다.
<script src="/ext-5.0.1/build/ext-all-debug.js"></script>
.

두 번째는 모든 구성 요소와 클래스를 예상대로 포함합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top