We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
问题描述 h5页面在history模式下, 通过vue-cli-plugin-uni/packages/h5-vue-router处理后的链接会解析错误
复现步骤 [复现问题的步骤]
[或者可以直接贴源代码]
预期结果 链接不应该发生跳转, 跳转也应该是一个正确合法的链接地址
实际结果 打开页面之后会发现链接 被修改成了http://localhost:8080/[object%20Object]
系统信息:
npm run info
Environment Info:
System: OS: macOS 10.14.6 CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz Binaries: Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm Browsers: Chrome: 80.0.3987.149 Firefox: 72.0.1 Safari: 12.1.2 npmPackages: @dcloudio/uni-app-plus: ^2.0.0-25120200103006 => 2.0.0-25120200103006 @dcloudio/uni-app-plus-nvue: 0.0.1 @dcloudio/uni-app-plus-nvue-v8: 0.0.1 @dcloudio/uni-cli-shared: ^2.0.0-26520200314001 => 2.0.0-26520200314001 @dcloudio/uni-h5: ^2.0.0-26520200314001 => 2.0.0-26520200314001 @dcloudio/uni-helper-json: * => 1.0.5 @dcloudio/uni-migration: ^2.0.0-26520200314001 => 2.0.0-26520200314001 @dcloudio/uni-mp-alipay: ^2.0.0-25120200103006 => 2.0.0-25120200103006 @dcloudio/uni-mp-baidu: ^2.0.0-25120200103006 => 2.0.0-25120200103006 @dcloudio/uni-mp-qq: ^2.0.0-25120200103006 => 2.0.0-25120200103006 @dcloudio/uni-mp-toutiao: ^2.0.0-25120200103006 => 2.0.0-25120200103006 @dcloudio/uni-mp-weixin: ^2.0.0-26520200314001 => 2.0.0-26520200314001 @dcloudio/uni-stat: ^2.0.0-25120200103006 => 2.0.0-25120200103006 (2.0.0-26520200314001) @dcloudio/uni-template-compiler: ^2.0.0-26520200314001 => 2.0.0-26520200314001 @dcloudio/vue-cli-plugin-hbuilderx: ~2.0.0-26520200314001 => 2.0.0-26520200314001 @dcloudio/vue-cli-plugin-uni: ~2.0.0-26520200314001 => 2.0.0-26520200314001 @dcloudio/vue-cli-plugin-uni-optimize: ~2.0.0-26520200314001 => 2.0.0-26520200314001 @dcloudio/webpack-uni-mp-loader: ^2.0.0-26520200314001 => 2.0.0-26520200314001 @dcloudio/webpack-uni-nvue-loader: 0.0.1 @dcloudio/webpack-uni-pages-loader: ^2.0.0-26520200314001 => 2.0.0-26520200314001 @vue/babel-helper-vue-jsx-merge-props: 1.0.0 @vue/babel-plugin-transform-vue-jsx: 1.1.2 @vue/babel-preset-app: 3.12.1 @vue/babel-preset-jsx: 1.1.2 @vue/babel-sugar-functional-vue: 1.1.2 @vue/babel-sugar-inject-h: 1.1.2 @vue/babel-sugar-v-model: 1.1.2 @vue/babel-sugar-v-on: 1.1.2 @vue/cli-overlay: 4.2.2 @vue/cli-plugin-babel: 3.5.1 => 3.5.1 @vue/cli-plugin-router: 4.2.2 @vue/cli-plugin-vuex: 4.2.2 @vue/cli-service: ~4.2.0 => 4.2.2 @vue/cli-shared-utils: 3.12.1 @vue/component-compiler-utils: 3.1.1 (3.1.1) @vue/preload-webpack-plugin: 1.1.1 @vue/web-component-wrapper: 1.2.0 mpvue-page-factory: 1.0.1 mpvue-template-compiler: 1.0.13 uni-h5-vue: 2.6.10 uni-mp-vue: 2.6.10 vue: ^2.6.11 => 2.6.11 vue-hot-reload-api: 2.3.4 vue-loader: 15.9.0 (15.9.0) vue-router: 3.0.1 vue-style-loader: 4.1.2 vue-template-compiler: ^2.6.11 => 2.6.11 vue-template-es2015-compiler: 1.9.1 vuex: ^3.0.1 => 3.1.2 npmGlobalPackages: @vue/cli: 4.2.2
补充信息 已调试代码, 猜测原因如下:
// node_modules/@dcloudio/vue-cli-plugin-uni/packages/h5-vue-router/dist/vue-router.esm.js //2280行: HTML5History.prototype.ensureURL = function ensureURL (push ) { if (getLocation(this.base) !== this.current.fullPath) { // getLocation得到的是一个decode的url, 而this.current.fullPath并没有经过decode, 因此带 ":"的链接在该条件下会不相等, 继而让代码执行发生了后续错误的跳转行为 var current = cleanPath(this.base + this.current.fullPath); // fixed by xxxxxx var location = { path: current, params: { __id__: this.current.params.__id__ } }; push ? pushState(location, location.params.__id__) : replaceState(location, location.params.__id__); } }; // 2306行: function getLocation (base) { var path = decodeURI(window.location.pathname); if (base && path.indexOf(base) === 0) { path = path.slice(base.length); } return (path || '/') + window.location.search + window.location.hash }
The text was updated successfully, but these errors were encountered:
fix(h5): improve ensureURL for edge cases #1433 #1082 #661#445
eb992ac
fxy060608
No branches or pull requests
问题描述
h5页面在history模式下, 通过vue-cli-plugin-uni/packages/h5-vue-router处理后的链接会解析错误
复现步骤
[复现问题的步骤]
4.观察链接
[或者可以直接贴源代码]
预期结果
链接不应该发生跳转, 跳转也应该是一个正确合法的链接地址
实际结果
打开页面之后会发现链接 被修改成了http://localhost:8080/[object%20Object]
系统信息:
npm run info
的运行结果]uni-app v2.6.5
uni-app cli v2.0.0-26520200314001
Environment Info:
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Binaries:
Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
Browsers:
Chrome: 80.0.3987.149
Firefox: 72.0.1
Safari: 12.1.2
npmPackages:
@dcloudio/uni-app-plus: ^2.0.0-25120200103006 => 2.0.0-25120200103006
@dcloudio/uni-app-plus-nvue: 0.0.1
@dcloudio/uni-app-plus-nvue-v8: 0.0.1
@dcloudio/uni-cli-shared: ^2.0.0-26520200314001 => 2.0.0-26520200314001
@dcloudio/uni-h5: ^2.0.0-26520200314001 => 2.0.0-26520200314001
@dcloudio/uni-helper-json: * => 1.0.5
@dcloudio/uni-migration: ^2.0.0-26520200314001 => 2.0.0-26520200314001
@dcloudio/uni-mp-alipay: ^2.0.0-25120200103006 => 2.0.0-25120200103006
@dcloudio/uni-mp-baidu: ^2.0.0-25120200103006 => 2.0.0-25120200103006
@dcloudio/uni-mp-qq: ^2.0.0-25120200103006 => 2.0.0-25120200103006
@dcloudio/uni-mp-toutiao: ^2.0.0-25120200103006 => 2.0.0-25120200103006
@dcloudio/uni-mp-weixin: ^2.0.0-26520200314001 => 2.0.0-26520200314001
@dcloudio/uni-stat: ^2.0.0-25120200103006 => 2.0.0-25120200103006 (2.0.0-26520200314001)
@dcloudio/uni-template-compiler: ^2.0.0-26520200314001 => 2.0.0-26520200314001
@dcloudio/vue-cli-plugin-hbuilderx: ~2.0.0-26520200314001 => 2.0.0-26520200314001
@dcloudio/vue-cli-plugin-uni: ~2.0.0-26520200314001 => 2.0.0-26520200314001
@dcloudio/vue-cli-plugin-uni-optimize: ~2.0.0-26520200314001 => 2.0.0-26520200314001
@dcloudio/webpack-uni-mp-loader: ^2.0.0-26520200314001 => 2.0.0-26520200314001
@dcloudio/webpack-uni-nvue-loader: 0.0.1
@dcloudio/webpack-uni-pages-loader: ^2.0.0-26520200314001 => 2.0.0-26520200314001
@vue/babel-helper-vue-jsx-merge-props: 1.0.0
@vue/babel-plugin-transform-vue-jsx: 1.1.2
@vue/babel-preset-app: 3.12.1
@vue/babel-preset-jsx: 1.1.2
@vue/babel-sugar-functional-vue: 1.1.2
@vue/babel-sugar-inject-h: 1.1.2
@vue/babel-sugar-v-model: 1.1.2
@vue/babel-sugar-v-on: 1.1.2
@vue/cli-overlay: 4.2.2
@vue/cli-plugin-babel: 3.5.1 => 3.5.1
@vue/cli-plugin-router: 4.2.2
@vue/cli-plugin-vuex: 4.2.2
@vue/cli-service: ~4.2.0 => 4.2.2
@vue/cli-shared-utils: 3.12.1
@vue/component-compiler-utils: 3.1.1 (3.1.1)
@vue/preload-webpack-plugin: 1.1.1
@vue/web-component-wrapper: 1.2.0
mpvue-page-factory: 1.0.1
mpvue-template-compiler: 1.0.13
uni-h5-vue: 2.6.10
uni-mp-vue: 2.6.10
vue: ^2.6.11 => 2.6.11
vue-hot-reload-api: 2.3.4
vue-loader: 15.9.0 (15.9.0)
vue-router: 3.0.1
vue-style-loader: 4.1.2
vue-template-compiler: ^2.6.11 => 2.6.11
vue-template-es2015-compiler: 1.9.1
vuex: ^3.0.1 => 3.1.2
npmGlobalPackages:
@vue/cli: 4.2.2
补充信息
已调试代码, 猜测原因如下:
The text was updated successfully, but these errors were encountered: