Titanium - 未找到请求的模块:alloy/controllers/undefined

Titanium - Requested module not found: alloy/controllers/undefined

我只是按照 appcelerator 上的指南进行操作,但有些地方不起作用。 这是错误消息:

TiExceptionHandler: (main) [0,29887] - In ti:/module.js:280,9
[ERROR] :  TiExceptionHandler: (main) [0,29887] - Message: Uncaught Error: Requested module not found: alloy/controllers/undefined
[ERROR] :  TiExceptionHandler: (main) [1,29888] - Source:       throw new Error("Requested module not found: " + request);
[ERROR] :  V8Exception: Exception occurred at ti:/module.js:280: Uncaught Error: Requested module not found: alloy/controllers/undefined

index.js:

$.index.open();

var myBooks = Alloy.Collections.books;

var book = Alloy.createModel("books",{
    title: "Great Expectations",
    author: "Charles Dickens"
});

myBooks.add(book);
book.save();

function showBook(event){
    console.log( event );
    var selectedBook = event.source;
    var args = {
        title: selectedBook.title,
        author: selectedBook.author
    };

    var bookView = Alloy.createController("bookdetails". args).getView();
    bookView.open();
}

bookdetails.js:

var args = arguments[0] || {};
$.titleLabel.text = args.title || "Default Title";
$.authorLabel.text = args.author || "Default author";

在使用控制器定义新视图时,如果要将多个参数作为参数传递给控制器​​,则需要在逗号分隔列表中分隔这些参数。

Alloy.createController('viewname', args).getView();

你的句号导致 alloy 抛出异常。