import Router from 'react-router/lib/Router'; import Link from 'react-router/lib/Link'; import browserHistory from 'react-router/lib/browserHistory'; import '../../less/account/account.less'; const {domain} = window.supervar; var childlist=[ <% for(var i=0;i{txt:"<%= txt %>",child:[ <% for(var j=0;j{txt:"<%= txt %>",<%= link?"link":"href" %>:`<%= link || href %>`<%= ref?",ref:'"+ref+"'":"" %>}, <% } %>]}, <% }else{ link=childlist[i].link; href=childlist[i].href; ref=childlist[i].myref; %>{txt:"<%= txt %>",<%= link?"link":"href" %>:`<%= link || href %>`<%= ref?",ref:'"+ref+"'":"" %>}, <% } }%> ] /* your logic code */ class Content extends React.Component{ constructor(){ super(); this.state = { userInfo : {}, hideSidebar : false, routerName : '<%= myrouter %>' } } componentWillMount(){ document.getElementById("container").style.opacity=1; if(window.supervar.myreflux){ window.supervar.myreflux.on('userInfoUpdate',(data)=>{ this.setState({userInfo:data}) }) } } changeState(name,value){ this.setState({[name]:value}); } showchild(e,index){ e.stopPropagation(); var span=this.refs["span"+index]; var ol=this.refs["ol"+index]; if(span.className=="icon-nav fr"){ span.className="icon-nav fr on"; ol.className=""; }else { span.className="icon-nav fr"; ol.className="none"; }; } stop(e){ e.stopPropagation(); } navSelect(e){ let active = document.getElementsByClassName("links selected"); for(let i=0;i
{ this.props.children && React.cloneElement(this.props.children, { userInfo:this.state.userInfo, changeState:this.changeState.bind(this) }) }
) } } var routes = { path: '/<%= currlang %>page/<%= myrouter %>/', component: Content, indexRoute: { getComponent: (nextState, cb) => { require.ensure([], (require) => { cb(null, require("./home/home")); },"/<%= currlang %>source/js/<%= myrouter %>/home/home") } }, childRoutes: [ <% for(var i=0;i{ path: "<%= link %>", getComponent: (nextState, cb) => { require.ensure([], (require) => { cb(null, require("<%= req %>")); },"<%= file %>") } },<% } } }else{ link=childlist[i].link; req=childlist[i].req; file=childlist[i].file; if(req){ %>{ path: "<%= link %>", getComponent: (nextState, cb) => { require.ensure([], (require) => { cb(null, require("<%= req %>")); },"<%= file %>") } },<% } } }%> ] } class Myrouter extends React.Component{ componentWillMount(){ document.getElementById("container").style.opacity=1; } render(){ return( ) } } var Wrap = window.supervar.Wrap; var content=ReactDOM.render( , document.getElementById("container") );