根據說明here爲了使用Native API我需要在代碼中添加'Ext.require()'。我如何在Sencha Architect 2中做到這一點?好像自定義函數或事件以外的所有內容都是隻讀的,所以我不能只是自己添加自己的代碼。如何在Sencha Architect中添加'Ext.require'2
回答
如Bharat Nagwani所建議的,架構師現在包含一種方法來要求您想要動態加載的任何類。
盧卡坎德拉和我提出了一個小應用程序,它說明了幾周前在倫敦使用Ext.device.Camera API。 https://github.com/CaliLuke/NativeContacts
爲了在您的應用程序的設備API,請執行以下操作:
- 走進了煎茶SDK和設備文件夾複製到你的項目目錄
- 內部建築師,點擊應用節點
- 搜索「要求」在配置面板
- 添加「Ext.device.Camera」的要求配置
- 搜索在配置面板
- 「裝載機」點擊+裝載機配置權
- 單擊新添加的「裝載機」節點(應用程序的孩子)
- 添加路徑「{「Ext.device 「:」device /「}
因此總結一下,確保文件在那裏。告訴應用程序您需要該類,然後告訴加載程序在哪裏可以找到剛放入項目文件夾的文件。
Architect中的下一個更新提供了作爲Application節點上的屬性的需求,因此您可以在其中添加該屬性。現在只需在您的應用程序啓動函數中添加require,因爲它是可寫的。
看到我試過,但我不認爲它的作品。如果我嘗試引用Ext.device命名空間來查看我的應用程序剛剛打破的任何內容(即在iPhone模擬器上)。沒有這個,該應用程序工作得很好。你能提供更多的信息嗎? – fnCzar
需要代碼的視圖(或適用於MVC)定義了這一要求,因此只有在需要時才調用它。
Ext.define('MyApp.view.SomePageView', {
extend: 'Ext.Panel',
alias: 'widget.somepageview',
requires: [
'Ext.device.Camera', // requires go here!
'...'
]
對於原生需求(事情不是自定義擴展),請檢查Sencha Docs上的右列。對於這個例子,對於ST2.3.1,它可以位於here。在頂部,你可以看到Ext.device.Camera直接從Ext.Base下降,不需要Ext.device。在被定義的那部分需求的底部,有Camera.js的鏈接。打開該鏈接,你可以看到究竟發生了什麼。通過定義requires: ['Ext.device.Camera']
,您也可以自動加載所有需要操作的內容。
在Architect中,當您定義主MVC或S時,它會被添加到Application Requires中。所以在Architect中,我將能夠看到Application> Ext.app.Controller> views下列出的SomePageView。在構建過程中,無論是使用Architect的構建,還是使用Sencha Cmd的命令行調用,如sencha app build
,這個通過應用程序的鏈需要包含在最終包中。
- 1. Sencha Ext JS Architect - 如何添加插件
- 2. 如何在Sencha Architect中加載KitchenSink?
- 3. 如何在Sencha Architect 2中爲多個項目添加'Ext.require'?
- 4. Sencha Architect svn IDE
- 5. Sencha Architect xtype change
- 6. 將項目添加到Sencha Architect中的列4
- 7. Sencha Touch Architect驗證
- 8. Sencha Architect XTemplate範圍
- 9. 滑塊值 - Sencha Architect
- 10. 如何爲Sencha Architect中的onTap處理程序添加phonegap回調函數2
- 11. Sencha Architect 2 - 如何編輯代碼
- 12. 在Sencha Architect中擴展Grid面板
- 13. 在Sencha Architect中更改視圖
- 14. 如何在Sencha Architect中動態設置Ext.Img - >「src」的值
- 15. 如何在Architect中打開Sencha Docs示例?
- 16. 如何在Sencha Architect中創建一個函數?
- 17. 如何在Sencha Architect 2中編輯控制器?
- 18. 如何在Sencha Architect中創建文件夾明智的視圖?
- 19. 如何在Liferay中運行Sencha Architect MVC應用程序
- 20. 如何在Sencha Architect中使用面板作爲按鈕菜單?
- 21. Sencha Architect創建覆蓋
- 22. Enterprise Architect:如何在C#中將TaggedValue添加到包中#
- 23. 如何在Enterprise Architect 9.3中添加決策分支標籤?
- 24. 如何將控制器引用到Sencha Architect中的視圖?
- 25. store.loadData未定義。如何將數據加載到存儲中Sencha Architect
- 26. 如何將sencha按鈕添加到sencha列表中
- 27. 如何在Ext JS 4.2(Sencha Architect)中的事件中運行控制器方法
- 28. Sencha Architect自動創建ViewModel和ViewController
- 29. Sencha Architect:建立模型的子類
- 30. 奇怪的情況Sencha Architect EXT JS
非常感謝,清除它! – fnCzar