Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

常见问题&以及解决方案 - 看过来 #71

Open
gogoyqj opened this issue Jun 11, 2015 · 3 comments
Open

常见问题&以及解决方案 - 看过来 #71

gogoyqj opened this issue Jun 11, 2015 · 3 comments

Comments

@gogoyqj
Copy link
Contributor

gogoyqj commented Jun 11, 2015

TypeError: avalon.require is not a function --mmState.js 有什么办法,用的是avalon.shim.js

重写avalon.controller.loader【或者avalon.require = requrejs,如果你使用的是requirejs】
这是默认的loader:

avalon.controller.loader = function (url, callback) {
        // 没有错误回调...
        avalon.require(url, function ($ctrl) {
            callback && callback($ctrl);
        });
    };

重写为:

avalon.controller.loader = function (url, callback) {
        // 没有错误回调...
        requrejs(url, function ($ctrl) {
            callback && callback($ctrl);
        });
    };

请确保以上的操作发生在:

            avalon.history.start({
                // basepath: "/mmRouter",
                fireAnchor: false
            })

之前

@gogoyqj
Copy link
Contributor Author

gogoyqj commented Jun 11, 2015

打印错误,请配置:

avalon.state.config({
    onError: function() {console.log(arguments)}
})

@gogoyqj
Copy link
Contributor Author

gogoyqj commented Jun 11, 2015

引入./mmRouter/mmState回调未执行,报" avalon.state is not a function"或者"avalon.ajax is not a function"

  • requirejs的loader和avalon的loader存在一些区别,这个暂且看起来需要把mmState.js里define的一个参数name以及mmRequest.js的define第一个参数name去掉

@gogoyqj
Copy link
Contributor Author

gogoyqj commented Jun 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant