提交 2abdf026 编写于 作者: fxy060608's avatar fxy060608

fix(h5): router

上级 08563021
......@@ -863,10 +863,10 @@ end-of-stream@^1.1.0:
dependencies:
once "^1.4.0"
esbuild@^0.9.3:
version "0.9.7"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.9.7.tgz#ea0d639cbe4b88ec25fbed4d6ff00c8d788ef70b"
integrity sha512-VtUf6aQ89VTmMLKrWHYG50uByMF4JQlVysb8dmg6cOgW8JnFCipmz7p+HNBl+RR3LLCuBxFGVauAe2wfnF9bLg==
esbuild@^0.11.19:
version "0.11.20"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.11.20.tgz#7cefa1aee8b372c184e42457885f7ce5d3e62a1e"
integrity sha512-QOZrVpN/Yz74xfat0H6euSgn3RnwLevY1mJTEXneukz1ln9qB+ieaerRMzSeETpz/UJWsBMzRVR/andBht5WKw==
escalade@^3.1.1:
version "3.1.1"
......@@ -2450,11 +2450,11 @@ verror@1.10.0:
extsprintf "^1.2.0"
vite@^2.2.3:
version "2.2.4"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.2.4.tgz#8f9cc85aacab04c850085894b086c8717f12ed16"
integrity sha512-vnIwSNci+phFMp6krhy+FbYzKL0R67Sdt9mVZ96S27AewrApSJjTqncJcalk8sf60BgcbW4+1C6DFIWkxquO9g==
version "2.3.0"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.3.0.tgz#02b007c7aa4ac88cc18f854b9c68e4fbe76e3ef4"
integrity sha512-gsCy0t3X9nGGYDoNiE2NJgYq6BPxrtKeo6FkpMXdMvtUluYxnRhl7xfpHaYDmQLCnMbYTWhvWS1L/Hpw/V9L5w==
dependencies:
esbuild "^0.9.3"
esbuild "^0.11.19"
postcss "^8.2.1"
resolve "^1.19.0"
rollup "^2.38.5"
......
......@@ -9884,6 +9884,8 @@ exports.markRaw = markRaw;
exports.mergeProps = mergeProps;
exports.nextTick = nextTick;
exports.onActivated = onActivated;
exports.onBeforeActivate = onBeforeActivate;
exports.onBeforeDeactivate = onBeforeDeactivate;
exports.onBeforeMount = onBeforeMount;
exports.onBeforeUnmount = onBeforeUnmount;
exports.onBeforeUpdate = onBeforeUpdate;
......
......@@ -9894,4 +9894,4 @@ const compile$1 = () => {
}
};
export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, compile$1 as compile, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, createApp as createVueApp, customRef, defineAsyncComponent, defineComponent, defineEmit, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useContext, useCssModule, useCssVars, useSSRContext, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers, withScopeId };
export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, compile$1 as compile, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, createApp as createVueApp, customRef, defineAsyncComponent, defineComponent, defineEmit, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeProps, nextTick, onActivated, onBeforeActivate, onBeforeDeactivate, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useContext, useCssModule, useCssVars, useSSRContext, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers, withScopeId };
......@@ -1150,8 +1150,12 @@ function createRouterOptions() {
};
}
function initHistory() {
let {base} = __uniConfig.router;
if (base === "/") {
base = "";
}
{
return vueRouter.createMemoryHistory(__uniConfig.router.base);
return vueRouter.createMemoryHistory(base);
}
}
var index$s = {
......
......@@ -4670,7 +4670,11 @@ function removeCurrentPages(delta = 1) {
}
}
function initHistory() {
const history2 = __UNI_FEATURE_ROUTER_MODE__ === "history" ? createWebHistory(__uniConfig.router.base) : createWebHashHistory(__uniConfig.router.base);
let {base} = __uniConfig.router;
if (base === "/") {
base = "";
}
const history2 = __UNI_FEATURE_ROUTER_MODE__ === "history" ? createWebHistory(base) : createWebHashHistory(base);
history2.listen((_to, _from, info) => {
if (info.direction === "back") {
removeCurrentPages(Math.abs(info.delta));
......
......@@ -45,13 +45,17 @@ function removeCurrentPages(delta: number = 1) {
}
function initHistory() {
let { base } = __uniConfig.router
if (base === '/') {
base = ''
}
if (__NODE_JS__) {
return createMemoryHistory(__uniConfig.router.base)
return createMemoryHistory(base)
}
const history =
__UNI_FEATURE_ROUTER_MODE__ === 'history'
? createWebHistory(__uniConfig.router.base)
: createWebHashHistory(__uniConfig.router.base)
? createWebHistory(base)
: createWebHashHistory(base)
history.listen((_to, _from, info) => {
if (info.direction === 'back') {
removeCurrentPages(Math.abs(info.delta))
......
......@@ -2,15 +2,13 @@ import path from 'path'
import slash from 'slash'
import { UserConfig } from 'vite'
import { VitePluginUniResolvedOptions } from '..'
import { FEATURE_DEFINES, initEasycomsOnce } from '../utils'
import { initEasycomsOnce } from '../utils'
export function createBuild(
options: VitePluginUniResolvedOptions,
features: FEATURE_DEFINES
options: VitePluginUniResolvedOptions
): UserConfig['build'] {
initEasycomsOnce(options.inputDir, options.platform)
return {
polyfillDynamicImport: features.__UNI_FEATURE_PAGES__,
rollupOptions: {
output: {
chunkFileNames(chunkInfo) {
......
......@@ -11,7 +11,6 @@ import { createServer } from './server'
import { createBuild } from './build'
import { createOptimizeDeps } from './optimizeDeps'
import { createDefine } from './define'
import { FEATURE_DEFINES } from '../utils'
function normalizeRoot(config: UserConfig) {
return normalizePath(config.root ? path.resolve(config.root) : process.cwd())
......@@ -34,7 +33,7 @@ export function createConfig(
resolve: createResolve(options, config),
optimizeDeps: createOptimizeDeps(options),
server: createServer(options),
build: createBuild(options, define as FEATURE_DEFINES),
build: createBuild(options),
css: createCss(options),
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册