Skip to content

Commit

Permalink
The route method was not returning an instance of itself
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarnadal committed Mar 12, 2018
1 parent 783aba9 commit 309c58c
Show file tree
Hide file tree
Showing 7 changed files with 3,308 additions and 15 deletions.
4 changes: 2 additions & 2 deletions dist/tidyroutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var installedModules={};/******/
/******/
return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([/* 0 */
/***/
function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _assign=__webpack_require__(1),_assign2=_interopRequireDefault(_assign),_map=__webpack_require__(38),_map2=_interopRequireDefault(_map),_classCallCheck2=__webpack_require__(82),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(83),_createClass3=_interopRequireDefault(_createClass2),_route=__webpack_require__(87),_route2=_interopRequireDefault(_route),__tidyRoutesInstance=null,TidyRoutes=function(){function TidyRoutes(){return(0,_classCallCheck3.default)(this,TidyRoutes),__tidyRoutesInstance||(this.routes=new _map2.default,__tidyRoutesInstance=this),__tidyRoutesInstance}return(0,_createClass3.default)(TidyRoutes,[{key:"export",value:function(){var _this=this,routes=[];return this.routes.forEach(function(option,path){var route=_this.routes.get(path),options=route.options;options.children=[];for(var _path in route.children){var child=route.children[_path];options.children.push((0,_assign2.default)({path:_path},child))}routes.push((0,_assign2.default)({path:path},options))}),routes}},{key:"route",value:function route(path,options){if(this.routes.has(path))return this.routes.get(path);var route=new _route2.default(path,options);return this.routes.set(path,route),route}}]),TidyRoutes}();exports.default=new TidyRoutes},/* 1 */
function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _assign=__webpack_require__(1),_assign2=_interopRequireDefault(_assign),_map=__webpack_require__(38),_map2=_interopRequireDefault(_map),_classCallCheck2=__webpack_require__(82),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(83),_createClass3=_interopRequireDefault(_createClass2),_route=__webpack_require__(87),_route2=_interopRequireDefault(_route),__tidyRoutesInstance=null,TidyRoutes=function(){function TidyRoutes(){return(0,_classCallCheck3.default)(this,TidyRoutes),__tidyRoutesInstance||(this.routes=new _map2.default,__tidyRoutesInstance=this),__tidyRoutesInstance}return(0,_createClass3.default)(TidyRoutes,[{key:"export",value:function(){var _this=this,routes=[];return this.routes.forEach(function(option,path){var route=_this.routes.get(path),options=route.options||{};options.children=[];for(var _path in route.children){var child=route.children[_path];options.children.push((0,_assign2.default)({path:_path},child))}routes.push((0,_assign2.default)({path:path},options))}),routes}},{key:"route",value:function route(path,options){if(this.routes.has(path))return this.routes.get(path);var route=new _route2.default(path,options);return this.routes.set(path,route),route}}]),TidyRoutes}();exports.default=new TidyRoutes},/* 1 */
/***/
function(module,exports,__webpack_require__){module.exports={default:__webpack_require__(2),__esModule:!0}},/* 2 */
/***/
Expand Down Expand Up @@ -434,4 +434,4 @@ function(module,exports,__webpack_require__){var $export=__webpack_require__(4);
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S+$export.F*!__webpack_require__(14),"Object",{defineProperty:__webpack_require__(10).f})},/* 87 */
/***/
function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _classCallCheck2=__webpack_require__(82),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(83),_createClass3=_interopRequireDefault(_createClass2),Route=function(){function Route(path,options){if((0,_classCallCheck3.default)(this,Route),this.path=path,this.options=options,this.children={},options.hasOwnProperty("children")){for(var _path in options.children)this.child(_path,options.children[_path]);delete options.children}return options.component}return(0,_createClass3.default)(Route,[{key:"child",value:function(path,options){return this.children[path]=options,this}}]),Route}();exports.default=Route}])});
function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _classCallCheck2=__webpack_require__(82),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(83),_createClass3=_interopRequireDefault(_createClass2),Route=function(){function Route(path,options){if((0,_classCallCheck3.default)(this,Route),this.path=path,this.options=options||{},this.children={},this.options.hasOwnProperty("children")){for(var _path in this.options.children)this.child(_path,this.options.children[_path]);delete this.options.children}return this}return(0,_createClass3.default)(Route,[{key:"child",value:function(path,options){return this.children[path]=options,this}}]),Route}();exports.default=Route}])});
2 changes: 1 addition & 1 deletion dist/tidyroutes.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions example/component3.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
import Routes from 'vue-tidyroutes';

const ChildComponent3 = { template: '<div>child component 3</div>' };
const ChildComponent4 = { template: '<div>child component 4</div>' };

Routes.route('/component2')
.child('child-3', {
name: 'child-3',
component: ChildComponent3
})
.child('child-4', {
name: 'child-4',
component: ChildComponent4
});

export default ChildComponent3;
Loading

0 comments on commit 309c58c

Please sign in to comment.