From c9898d6bec3c826f4bae4a154dcb5928c805202a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 13 Dec 2019 10:35:22 +0800 Subject: [PATCH] fix(cli): incorrect mobile relative path --- packages/vant-cli/site/desktop/App.vue | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/vant-cli/site/desktop/App.vue b/packages/vant-cli/site/desktop/App.vue index 66470f185..78270daf0 100644 --- a/packages/vant-cli/site/desktop/App.vue +++ b/packages/vant-cli/site/desktop/App.vue @@ -17,25 +17,17 @@ import VanDoc from './components'; import { config, packageVersion } from 'site-desktop-shared'; import { setLang } from '../common/locales'; -function getPublicPath() { - const { site } = config.build || {}; - - if (process.env.NODE_ENV === 'production') { - return (site && site.publicPath) || '/'; - } - - return '/'; -} - export default { components: { VanDoc }, data() { + const path = location.pathname.replace('/index', '/'); + return { packageVersion, - simulator: `${getPublicPath()}mobile.html${location.hash}` + simulator: `${path}mobile.html${location.hash}` }; },