View 尝试在appcelerator上打开新视图时出错
我正在用appcelerator构建一个简单的应用程序。 所以我有一个索引视图,当应用程序启动时,我希望这个索引视图打开登录视图 所以我有这个: login.xmlView 尝试在appcelerator上打开新视图时出错,view,appcelerator,View,Appcelerator,我正在用appcelerator构建一个简单的应用程序。 所以我有一个索引视图,当应用程序启动时,我希望这个索引视图打开登录视图 所以我有这个: login.xml <Alloy> <View class="container"> <View class="images"></View> <Label id="loginLable" class="loginLable">A
<Alloy>
<View class="container">
<View class="images"></View>
<Label id="loginLable"
class="loginLable">Accedi</Label>
<TextField class="textLogin"></TextField>
</View>
</Alloy>
index.js
// Arguments passed into this controller can be accessed via the `$.args` object directly or:
var args = $.args;
function loginEventListener(e){
Ti.API.info("You clicked the button");
};
var login = Alloy.createController("login",args).getView();
login.open();
如果我尝试启动此应用程序,则出现以下错误:
[ERROR] : TiExceptionHandler: (main) [19654,21610] ----- Titanium Javascript Runtime Error -----
[ERROR] : TiExceptionHandler: (main) [0,21610] - In alloy/controllers/index.js:35,11
[ERROR] : TiExceptionHandler: (main) [2,21612] - Message: Uncaught TypeError: Object #<View> has no method 'open'
[ERROR] : TiExceptionHandler: (main) [1,21613] - Source: login.open();
[ERROR] : V8Exception: Exception occurred at alloy/controllers/index.js:35: Uncaught TypeError: Object #<View> has no method 'open'
[ERROR]:TiExceptionHandler:(main)[1965421610]----Tianium Javascript运行时错误-----
[错误]:TiExceptionHandler:(main)[021610]-在alloy/controllers/index.js:35,11中
[错误]:TiExceptionHandler:(主)[221612]-消息:未捕获类型错误:对象#没有方法“打开”
[错误]:TiExceptionHandler:(主)[121613]-源代码:login.open();
[错误]:V8Exception:alloy/controllers/index.js:35:未捕获类型错误:对象#没有方法“打开”
您无法“打开”视图。它需要一个容器。您可以将其添加到已打开的窗口,也可以将控制器设置为窗口<代码>打开()对于该视图不存在
<Alloy>
<Window>
<View class="container">
<View class="images"></View>
<Label id="loginLable"
class="loginLable">Accedi</Label>
<TextField class="textLogin"></TextField>
</View>
</Window>
</Alloy>
阿克迪
然后,要打开它,您可以执行与之前相同的操作