refactor(dev): 将 $__DEV__ 重命名为 __DEV__

This commit is contained in:
严浩
2025-08-14 14:31:19 +08:00
parent 231249b357
commit 1d4f3b601a
12 changed files with 14 additions and 14 deletions

View File

@@ -425,7 +425,7 @@ watchEffect(() => {
<template> <template>
<!-- <pre <!-- <pre
v-if="$__DEV__" v-if="__DEV__"
class="fixed bottom-10 right-10 top-10 z-[9999] overflow-auto overflow-y-auto bg-white p-[10px] text-[12px] text-black" class="fixed bottom-10 right-10 top-10 z-[9999] overflow-auto overflow-y-auto bg-white p-[10px] text-[12px] text-black"
>{{ { 选项卡菜单7个: $enum(E_选项卡菜单).getValues(), ...state } }}</pre >{{ { 选项卡菜单7个: $enum(E_选项卡菜单).getValues(), ...state } }}</pre
> --> > -->

View File

@@ -25,7 +25,7 @@ export class HCesiumManager {
try { try {
this.viewer = new Cesium.Viewer(container, VIEWER_OPTIONS_FN()); this.viewer = new Cesium.Viewer(container, VIEWER_OPTIONS_FN());
if ($__DEV__) Object.assign(globalThis, { viewer: this.viewer }); if (__DEV__) Object.assign(globalThis, { viewer: this.viewer });
configureTimeLine(this.viewer); configureTimeLine(this.viewer);

View File

@@ -6,7 +6,7 @@ import { HCesiumManager } from './managers/HCesiumManager';
export function useHCesiumManager(containerId: string) { export function useHCesiumManager(containerId: string) {
const hCesiumViewerManager = ref(new HCesiumManager()); const hCesiumViewerManager = ref(new HCesiumManager());
// 可以在开发模式下暴露 manager 实例,方便调试 // 可以在开发模式下暴露 manager 实例,方便调试
if ($__DEV__) Object.assign(globalThis, { hCesiumViewerManager }); if (__DEV__) Object.assign(globalThis, { hCesiumViewerManager });
onMounted(() => { onMounted(() => {
hCesiumViewerManager.value.init(containerId); hCesiumViewerManager.value.init(containerId);

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
const { isActive: isCounting, remaining: countdownTime, start: startCountdown } = useCountdown($__DEV__ ? 3 : 60); const { isActive: isCounting, remaining: countdownTime, start: startCountdown } = useCountdown(__DEV__ ? 3 : 60);
const isSending = ref(false); const isSending = ref(false);
const sendSms = async () => { const sendSms = async () => {

View File

@@ -2,7 +2,7 @@
http://localhost:4730/Page/PinPuYi http://localhost:4730/Page/PinPuYi
--> -->
<script setup lang="ts"> <script setup lang="ts">
definePage({ meta: { title: '频谱仪', hidden: !$__DEV__ } }); definePage({ meta: { title: '频谱仪', hidden: !__DEV__ } });
</script> </script>
<template> <template>

View File

@@ -45,7 +45,7 @@ export const openDialog = async () => {
}); });
await nextTick(); await nextTick();
// if ($__DEV__) return; // if (__DEV__) return;
await new Promise((resolve) => setTimeout(resolve, 300)); await new Promise((resolve) => setTimeout(resolve, 300));
DialogService.open(dialogContent, { DialogService.open(dialogContent, {

View File

@@ -53,7 +53,7 @@ async function loadMore() {
}); });
const data = await response.json(); const data = await response.json();
state.list = [...state.list, ...data]; state.list = [...state.list, ...data];
if ($__DEV__) await new Promise((resolve) => setTimeout(resolve, 500)); if (__DEV__) await new Promise((resolve) => setTimeout(resolve, 500));
state.complete = state.list.length >= 5; state.complete = state.list.length >= 5;
} catch (error) { } catch (error) {
state.error = error; state.error = error;

View File

@@ -152,7 +152,7 @@ line2 += '9';
// '', // '',
// ); // );
// if ($__DEV__) { // if (__DEV__) {
// const tle = TLE_LIST[0] as string; // const tle = TLE_LIST[0] as string;
// const line1 = tle.split('\n')[1] as string; // const line1 = tle.split('\n')[1] as string;
// const line2 = tle.split('\n')[2] as string; // const line2 = tle.split('\n')[2] as string;
@@ -160,7 +160,7 @@ line2 += '9';
// twoline2satrecFake(line1, line2); // twoline2satrecFake(line1, line2);
// } // }
// if ($__DEV__) { // if (__DEV__) {
// const satrec2 = twoline2satrec( // const satrec2 = twoline2satrec(
// `1 62949 25070.91668981 .00039463 00000+0 99294-3 `, // `1 62949 25070.91668981 .00039463 00000+0 99294-3 `,
// `2 53.1596 120.9032 0001355 101.1211 35.9659 15.39574303 `, // `2 53.1596 120.9032 0001355 101.1211 35.9659 15.39574303 `,

View File

@@ -2,7 +2,7 @@ import { autoAnimatePlugin } from '@formkit/auto-animate/vue';
import { createHead } from '@unhead/vue/client'; import { createHead } from '@unhead/vue/client';
export function install({ app }: { app: import('vue').App<Element> }) { export function install({ app }: { app: import('vue').App<Element> }) {
app.config.globalProperties.$__DEV__ = $__DEV__; app.config.globalProperties.__DEV__ = __DEV__;
app.use(autoAnimatePlugin); // v-auto-animate="{ duration: 100 }" app.use(autoAnimatePlugin); // v-auto-animate="{ duration: 100 }"

View File

@@ -14,7 +14,7 @@ const router = createRouter({
strict: true, strict: true,
}); });
if (import.meta.hot) handleHotUpdate(router); if (import.meta.hot) handleHotUpdate(router);
if ($__DEV__) Object.assign(globalThis, { router }); if (__DEV__) Object.assign(globalThis, { router });
router.onError((error) => { router.onError((error) => {
console.debug('🚨 [router error]:', error); console.debug('🚨 [router error]:', error);
}); });

View File

@@ -1,9 +1,9 @@
declare global { declare global {
const $__DEV__: boolean; const __DEV__: boolean;
} }
declare module 'vue' { declare module 'vue' {
export interface ComponentCustomProperties { export interface ComponentCustomProperties {
$__DEV__: boolean; __DEV__: boolean;
} }
} }

View File

@@ -83,7 +83,7 @@ export default defineConfig(({ command, mode }) => {
sourcemap: mode !== 'production' || env.VITE_SOURCE_MAP === 'true', sourcemap: mode !== 'production' || env.VITE_SOURCE_MAP === 'true',
}, },
define: { define: {
$__DEV__: JSON.stringify(!isBuild), __DEV__: JSON.stringify(!isBuild),
CESIUM_BASE_URL: JSON.stringify(`/${cesiumBaseUrl}`), CESIUM_BASE_URL: JSON.stringify(`/${cesiumBaseUrl}`),
}, },
plugins: Plugins(), plugins: Plugins(),