Web路由、状态管理、模版框架
路由格式:/index/:param
使用:
var McCafeRouter = require('./McMcCafe_Router.js');
方法:
McCafeRouter.createRouter([
{path: '/', component: indexComponent},
{path: '/list', component: listComponent},
{path: '/detail/:index', component: detailComponent},
])
McCafeRouter.goTo('/detail/1');
McCafeRouter.getRouter();
McCafeRouter.getParam('index');
使用:
var McCafeState = require('./McCafe_State.js');
var insMcCafeState = new McCafeState({
key: {
val: 0,
callback: [callback]
},
});
方法:
insState.setState({
key: 'val'
});
insState.getState('key');
使用:
var McCafeTmpl = require('./McCafe_Tmpl.js');
方法:
var html = McCafeTmpl.tmpl('<div><%=name%></div>', {name: 'Memo'});
McCafeTmpl.render('.container', '<div><%=name%></div>', {name: 'Memo'});