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

feat: add process.env.UNI_PLATFORM

上级 fbf930ca
......@@ -16,15 +16,15 @@
"@dcloudio/uni-h5-vue": "../../uni-h5-vue",
"@dcloudio/uni-i18n": "../../uni-i18n",
"@dcloudio/uni-shared": "../../uni-shared",
"@vue/shared": "^3.1.0-beta.3",
"vue": "^3.1.0-beta.3"
"@vue/shared": "^3.1.0-beta.4",
"vue": "^3.1.0-beta.4"
},
"devDependencies": {
"@dcloudio/uni-cli-shared": "../../uni-cli-shared",
"@dcloudio/vite-plugin-uni": "../../vite-plugin-uni",
"@vitejs/plugin-vue": "^1.2.2",
"@vue/compiler-sfc": "^3.1.0-beta.3",
"@vue/server-renderer": "^3.1.0-beta.3",
"@vue/compiler-sfc": "^3.1.0-beta.4",
"@vue/server-renderer": "^3.1.0-beta.4",
"compression": "^1.7.4",
"cypress": "^7.3.0",
"serve-static": "^1.14.1",
......
......@@ -3060,7 +3060,6 @@ var Input = /* @__PURE__ */ defineBuiltInComponent({
const input = event.target;
if (NUMBER_TYPES.includes(props2.type)) {
valid.value = input.validity && input.validity.valid;
state2.value;
}
if (type.value === "number") {
const maxlength = state2.maxlength;
......
......@@ -485,7 +485,7 @@ var safeAreaInsets = {
onChange,
offChange
};
var D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out = safeAreaInsets;
var out = safeAreaInsets;
const onEventPrevent = /* @__PURE__ */ withModifiers(() => {
}, ["prevent"]);
const onEventStop = /* @__PURE__ */ withModifiers(() => {
......@@ -497,10 +497,10 @@ function getWindowOffset() {
const left = parseInt(style.getPropertyValue("--window-left"));
const right = parseInt(style.getPropertyValue("--window-right"));
return {
top: top ? top + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top : 0,
bottom: bottom ? bottom + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom : 0,
left: left ? left + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left : 0,
right: right ? right + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right : 0
top: top ? top + out.top : 0,
bottom: bottom ? bottom + out.bottom : 0,
left: left ? left + out.left : 0,
right: right ? right + out.right : 0
};
}
function updateCssVar(cssVars) {
......@@ -1194,7 +1194,7 @@ function normalizePageMeta(pageMeta) {
let offset = rpx2px(refreshOptions.offset);
const {type} = navigationBar;
if (type !== "transparent" && type !== "none") {
offset += NAVBAR_HEIGHT + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top;
offset += NAVBAR_HEIGHT + out.top;
}
refreshOptions.offset = offset;
refreshOptions.height = rpx2px(refreshOptions.height);
......@@ -4856,7 +4856,6 @@ var Input = /* @__PURE__ */ defineBuiltInComponent({
const input = event.target;
if (NUMBER_TYPES.includes(props2.type)) {
valid.value = input.validity && input.validity.valid;
state3.value;
}
if (type.value === "number") {
const maxlength = state3.maxlength;
......@@ -15009,7 +15008,7 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const windowWidth = getWindowWidth(screenWidth);
let windowHeight = window.innerHeight;
const language = navigator.language;
const statusBarHeight = D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top;
const statusBarHeight = out.top;
let osname;
let osversion;
let model;
......@@ -15122,12 +15121,12 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const system = `${osname} ${osversion}`;
const platform = osname.toLocaleLowerCase();
const safeArea = {
left: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left,
right: windowWidth - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right,
top: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top,
bottom: windowHeight - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom,
width: windowWidth - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right,
height: windowHeight - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom
left: out.left,
right: windowWidth - out.right,
top: out.top,
bottom: windowHeight - out.bottom,
width: windowWidth - out.left - out.right,
height: windowHeight - out.top - out.bottom
};
const {top: windowTop, bottom: windowBottom} = getWindowOffset();
windowHeight -= windowTop;
......@@ -15147,10 +15146,10 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
model,
safeArea,
safeAreaInsets: {
top: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top,
right: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right,
bottom: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom,
left: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left
top: out.top,
right: out.right,
bottom: out.bottom,
left: out.left
}
};
});
......
......@@ -28,7 +28,7 @@
"xmlhttprequest": "^1.8.0"
},
"peerDependencies": {
"@vue/shared": "^3.1.0-beta.3",
"@vue/shared": "^3.1.0-beta.4",
"vue-router": "^4.0.8"
},
"uni-app": {
......
......@@ -42,9 +42,9 @@
},
"peerDependencies": {
"@vitejs/plugin-vue": "^1.2.2",
"@vue/compiler-sfc": "^3.1.0-beta.3",
"@vue/server-renderer": "^3.1.0-beta.3",
"@vue/shared": "^3.1.0-beta.3",
"@vue/compiler-sfc": "^3.1.0-beta.4",
"@vue/server-renderer": "^3.1.0-beta.4",
"@vue/shared": "^3.1.0-beta.4",
"vite": "^2.3.0"
},
"devDependencies": {
......
import { extend } from '@vue/shared'
import { ConfigEnv, UserConfig } from 'vite'
import { VitePluginUniResolvedOptions } from '..'
import {
......@@ -11,12 +12,15 @@ export function createDefine(
config: UserConfig,
{ command }: ConfigEnv
): UserConfig['define'] {
return initFeatures({
inputDir,
command,
platform,
pagesJson: parsePagesJsonOnce(inputDir, platform),
manifestJson: parseManifestJsonOnce(inputDir),
ssr: isSsr(command, config) || isSsrManifest(command, config),
})
return extend(
{ 'process.env.UNI_PLATFORM': JSON.stringify(platform) },
initFeatures({
inputDir,
command,
platform,
pagesJson: parsePagesJsonOnce(inputDir, platform),
manifestJson: parseManifestJsonOnce(inputDir),
ssr: isSsr(command, config) || isSsrManifest(command, config),
})
)
}
......@@ -73,7 +73,7 @@ export function initPluginVueOptions(
const eventOpts = uniPlugins.reduce<Record<string, string>>(
(eventOpts, uniPlugin) => {
return extend(eventOpts, uniPlugin.uni?.transformEvent || {})
return extend(eventOpts, uniPlugin.uni?.transformEvent)
},
{}
)
......
{
"compilerOptions": {
"target": "esnext",
"target": "es2015",
"moduleResolution": "node",
"strict": true,
"declaration": false,
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册