swico 0.5.0-beta3 → 0.5.0-beta4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "0.5.0-beta3",
3
+ "version": "0.5.0-beta4",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -7,7 +7,6 @@ exports.getHistory = exports.pathNameList = exports.formatAncPath = exports.Hist
7
7
  var routes_1 = __importDefault(require("./routes"));
8
8
  var qs_1 = __importDefault(require("qs"));
9
9
  var history_1 = require("history");
10
- var tools_1 = require("../../utils/tools");
11
10
  var react_router_dom_1 = require("react-router-dom");
12
11
  Object.defineProperty(exports, "HistoryRouter", { enumerable: true, get: function () { return react_router_dom_1.unstable_HistoryRouter; } });
13
12
  var interpolatePath = function (pathTemplate, params) {
@@ -85,7 +84,8 @@ var getHistory = function (routerBase, routerType) {
85
84
  var _a;
86
85
  var history;
87
86
  var originalHistory = (_a = (routerType === 'hash' ? history_1.createHashHistory : history_1.createBrowserHistory)) === null || _a === void 0 ? void 0 : _a();
88
- var formatRouterBase = (0, tools_1.getFormatRouterBase)(routerBase);
87
+ var lastIndexBase = routerBase[routerBase.length - 1];
88
+ var formatRouterBase = lastIndexBase === '/' ? routerBase.slice(0, routerBase.length - 1) : routerBase;
89
89
  history = {
90
90
  go: originalHistory.go,
91
91
  forward: originalHistory.forward,
@@ -41,8 +41,18 @@ Swico.history = {
41
41
  back: router.back,
42
42
  forward: router.forward,
43
43
  get location() {
44
+ var lastIndexBase = config_1.routerBase[config_1.routerBase.length - 1];
45
+ var formatRouterBase = lastIndexBase === '/' ? config_1.routerBase.slice(0, config_1.routerBase.length - 1) : config_1.routerBase;
44
46
  var _a = router.currentRoute.value, path = _a.path, params = _a.params, query = _a.query, name = _a.name, hash = _a.hash, fullPath = _a.fullPath;
45
- return { path: path, pathname: fullPath, params: params, query: query, name: name, hash: hash, search: qs_1.default.stringify(query) };
47
+ return {
48
+ path: path,
49
+ pathname: formatRouterBase + path,
50
+ params: params,
51
+ query: query,
52
+ name: name,
53
+ hash: hash,
54
+ search: qs_1.default.stringify(query)
55
+ };
46
56
  }
47
57
  };
48
58
  app.component('Layout', Layout_1.default);