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

fix(ssr): Compatible with vite@3

上级 296f2d63
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<!--app-context--> <!--app-context-->
</head> </head>
<body> <body>
<div id="ssr-log"></div>
<div id="app"><!--app-html--></div> <div id="app"><!--app-html--></div>
<script type="module" src="/src/main.js"></script> <script type="module" src="/src/main.js"></script>
</body> </body>
......
<template> <template>
<view id="ssr-log"></view>
<page-meta> <page-meta>
<head> <head>
<meta name="keywords" content="uni-app ssr" /> <meta name="keywords" content="uni-app ssr" />
......
...@@ -3434,6 +3434,22 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({ ...@@ -3434,6 +3434,22 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
input.addEventListener("blur", resetCache); input.addEventListener("blur", resetCache);
return false; return false;
} }
if (cache.value) {
if (cache.value.indexOf(".") !== -1) {
if (event.data !== "." && event.inputType === "deleteContentBackward") {
const dotIndex = cache.value.indexOf(".");
cache.value = input.value = state2.value = cache.value.slice(0, dotIndex);
return true;
}
} else if (event.data === ".") {
cache.value += ".";
resetCache = () => {
cache.value = input.value = cache.value.slice(0, -1);
};
input.addEventListener("blur", resetCache);
return false;
}
}
cache.value = state2.value = input.value = cache.value === "-" ? "" : cache.value; cache.value = state2.value = input.value = cache.value === "-" ? "" : cache.value;
return false; return false;
} else { } else {
...@@ -7540,7 +7556,9 @@ function initHistory() { ...@@ -7540,7 +7556,9 @@ function initHistory() {
const index$f = { const index$f = {
install(app) { install(app) {
initApp$1(app); initApp$1(app);
app.config.warnHandler = warnHandler; if (!app.config.warnHandler) {
app.config.warnHandler = warnHandler;
}
if (__UNI_FEATURE_PAGES__) { if (__UNI_FEATURE_PAGES__) {
initRouter(app); initRouter(app);
} }
......
...@@ -9551,6 +9551,22 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({ ...@@ -9551,6 +9551,22 @@ const Input = /* @__PURE__ */ defineBuiltInComponent({
input.addEventListener("blur", resetCache); input.addEventListener("blur", resetCache);
return false; return false;
} }
if (cache.value) {
if (cache.value.indexOf(".") !== -1) {
if (event.data !== "." && event.inputType === "deleteContentBackward") {
const dotIndex = cache.value.indexOf(".");
cache.value = input.value = state3.value = cache.value.slice(0, dotIndex);
return true;
}
} else if (event.data === ".") {
cache.value += ".";
resetCache = () => {
cache.value = input.value = cache.value.slice(0, -1);
};
input.addEventListener("blur", resetCache);
return false;
}
}
cache.value = state3.value = input.value = cache.value === "-" ? "" : cache.value; cache.value = state3.value = input.value = cache.value === "-" ? "" : cache.value;
return false; return false;
} else { } else {
...@@ -15316,7 +15332,9 @@ const index$g = { ...@@ -15316,7 +15332,9 @@ const index$g = {
initApp$1(app); initApp$1(app);
initViewPlugin(app); initViewPlugin(app);
initServicePlugin(app); initServicePlugin(app);
app.config.warnHandler = warnHandler; if (!app.config.warnHandler) {
app.config.warnHandler = warnHandler;
}
if (__UNI_FEATURE_PAGES__) { if (__UNI_FEATURE_PAGES__) {
initRouter(app); initRouter(app);
} }
......
...@@ -11,7 +11,9 @@ export default { ...@@ -11,7 +11,9 @@ export default {
initViewPlugin(app) initViewPlugin(app)
initServicePlugin(app) initServicePlugin(app)
app.config.warnHandler = warnHandler if (!app.config.warnHandler) {
app.config.warnHandler = warnHandler
}
if (__UNI_FEATURE_PAGES__) { if (__UNI_FEATURE_PAGES__) {
initRouter(app) initRouter(app)
......
...@@ -1346,7 +1346,6 @@ function showToast({ icon = 'success' } = {}) { ...@@ -1346,7 +1346,6 @@ function showToast({ icon = 'success' } = {}) {
const args = { const args = {
title: 'content', title: 'content',
icon: 'type', icon: 'type',
duration: false,
image: false, image: false,
mask: false, mask: false,
}; };
......
...@@ -56,6 +56,8 @@ export async function createSSRServer( ...@@ -56,6 +56,8 @@ export async function createSSRServer(
*/ */
const vite = await createViteServer( const vite = await createViteServer(
addConfigFile({ addConfigFile({
// custom: don't include HTML middlewares
appType: 'custom',
root: process.env.VITE_ROOT_DIR, root: process.env.VITE_ROOT_DIR,
base: options.base, base: options.base,
mode: options.mode, mode: options.mode,
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册