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

有没有路由支持呢? #180

Closed
zhuman90 opened this issue May 9, 2017 · 3 comments
Closed

有没有路由支持呢? #180

zhuman90 opened this issue May 9, 2017 · 3 comments

Comments

@zhuman90
Copy link

zhuman90 commented May 9, 2017

之前用过了regular,挺好用的,兼容性也不错,但是好像没有路由,官方有提供路由支持吗?

@fengzilong
Copy link
Member

fengzilong commented May 9, 2017

@zhuman90
Copy link
Author

zhuman90 commented May 9, 2017

谢谢,我想问下,我访问路由#/app,报这个错误是为什么呢?
Uncaught TypeError: Regular.isRegular is not a function

var Regular = require('regularjs');
var restate  = require('regular-state');

var IndexComponent = require('./components/index');



var App = new Regular({
    template : require('./app.html')
    
});

const routes = {
    'app' : {
        view : App
    },
    'app.index' : {
        view : IndexComponent
    }
};

restate().state(routes).start({
    view : document.getElementById('app')
});

@leeluolee
Copy link
Member

内部用了 Regular.isRegular ,这个API低版本Regular不存在,我临时fix下 regularjs/regular-state#3 。 你也可以现在自己在代码里做个兼容。

if(!Regular.isRegular){
Regular.isRegular = function( Comp ){
return Comp.prototype instanceof Regular;
}
}

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

3 participants