nl_tokens: / * const initMatchRoutes = ( routes ) = > { // 初始化路由匹配 if ( routes && 0 < routes . length ) { for ( let i of routes ) { const { url id module } = i flag = : pos = url . indexOf ( flag ) - 1 suffix = 0 < pos ? url . match ( / \ : [ \ w ] + / g ) : false matchRoutes . push ( { url : suffix ? url . replace ( / \ : [ \ w ] + / g [ \\ w ] + ) : url id : id module : module suffix : suffix } ) } hasRoutes = true } } getMatchRoute = ( url ) = > { for ( let i of matchRoutes ) { let match ; // 标识是否匹配上 [ true|false ] let reg = new RegExp ( ^$ { i . url } \ / ?$ ) ; match = ( - 1 < url . search ( reg )) if ( match ) return i } 代码执行到这里证明没有匹配上 console . warn ( url match none!check you routes s config ) return false }
pl_tokens: function getMatchRoute ( path ) { var _iteratorNormalCompletion = true ; var _didIteratorError = false ; var _iteratorError = undefined ; try { for ( var _iterator = routes [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) { var route = _step . value ; if ( route . url === path ) { return route ; } } } catch ( err ) { _didIteratorError = true ; _iteratorError = err ; } finally { try { if ( ! _iteratorNormalCompletion && _iterator . return ) { _iterator . return ( ) ; } } finally { if ( _didIteratorError ) { throw _iteratorError ; } } } return <mask> ; }