Browse Source

style: 统一代码缩进为2个空格,提升代码可读性

此次提交主要将代码中的缩进统一调整为2个空格,替换原有的4个空格或Tab缩进。这一改动不影响代码功能,但有助于提升代码的一致性和可读性。
feat/icon
npmrun 3 weeks ago
parent
commit
b6964f5fbe
  1. 17
      resources/fuck.html
  2. 1
      src/main/modules/api/readme.md
  3. 1
      src/main/modules/api/test.ts
  4. 1175
      src/renderer/auto-imports.d.ts
  5. 17
      src/renderer/index.html
  6. 14
      src/renderer/src/App.vue
  7. 3
      src/renderer/src/assets/libs/scrollbot.ts
  8. 212
      src/renderer/src/components/AdjustLine.vue
  9. 75
      src/renderer/src/components/CodeEditor/code-editor.vue
  10. 42
      src/renderer/src/components/NavBar.vue
  11. 4
      src/renderer/src/components/Versions.vue
  12. 6
      src/renderer/src/layouts/default.vue
  13. 4
      src/renderer/src/pages/_ui/App.vue
  14. 232
      src/renderer/src/pages/_ui/Browser.vue
  15. 46
      src/renderer/src/pages/about/index.vue
  16. 86
      src/renderer/src/pages/browser.vue
  17. 8
      src/renderer/src/pages/index.vue
  18. 1
      src/types/global.d.ts
  19. 4
      推荐.md

17
resources/fuck.html

@ -1,11 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
前往 <a href="https://baidu.com" target="_blank">百度</a>
</body>
</head>
<body>
前往
<a href="https://baidu.com" target="_blank">百度</a>
</body>
</html>

1
src/main/modules/api/readme.md

@ -1,4 +1,3 @@
## 资源
- https://juejin.cn/post/7311619723317657611#heading-6

1
src/main/modules/api/test.ts

@ -69,4 +69,3 @@
// };
// ses.protocol.interceptBufferProtocol("https", interceptHandler);

1175
src/renderer/auto-imports.d.ts

File diff suppressed because it is too large

17
src/renderer/index.html

@ -1,17 +1,19 @@
<!doctype html>
<html>
<head>
<head>
<meta charset="UTF-8" />
<title>Electron</title>
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self' api: 'unsafe-inline';
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self' api: 'unsafe-inline';
script-src 'self' api:;
style-src 'self' 'unsafe-inline';
img-src 'self' data: *;" />
</head>
img-src 'self' data: *;"
/>
</head>
<body>
<body>
<div id="app"></div>
<noscript>
<style>
@ -21,6 +23,5 @@
</style>
</noscript>
<script type="module" src="/src/main.ts"></script>
</body>
</body>
</html>

14
src/renderer/src/App.vue

@ -14,17 +14,17 @@
</template>
<style lang="scss" scoped>
.slide-fade-enter-active {
.slide-fade-enter-active {
transition: all 0.2s ease-out;
}
}
.slide-fade-leave-active {
.slide-fade-leave-active {
transition: all 0.2s cubic-bezier(1, 0.5, 0.8, 1);
}
}
.slide-fade-enter-from,
.slide-fade-leave-to {
.slide-fade-enter-from,
.slide-fade-leave-to {
transform: translateX(20px);
opacity: 0;
}
}
</style>

3
src/renderer/src/assets/libs/scrollbot.ts

@ -205,8 +205,7 @@ class Scrollbot {
this.scrollBar.style.top = `${this.pC}%`
this.inP.scrollTop =
((parseFloat(this.scrollBar.style.top) -
((this.sbHeight - parseFloat(this.sB.height)) * this.inP.scrollTop) /
(this.inP.scrollHeight - this.inP.clientHeight)) *
((this.sbHeight - parseFloat(this.sB.height)) * this.inP.scrollTop) / (this.inP.scrollHeight - this.inP.clientHeight)) *
this.inP.scrollHeight) /
100
} else if (this.pC < 0 && parseFloat(this.scrollBar.style.top) > 0) {

212
src/renderer/src/components/AdjustLine.vue

@ -10,16 +10,16 @@
</template>
<script setup lang="ts">
import { nextTick, onMounted, ref, watch, computed, onBeforeUnmount, onErrorCaptured } from "vue"
import { useDebounceFn } from "@vueuse/core"
import { nextTick, onMounted, ref, watch, computed, onBeforeUnmount, onErrorCaptured } from "vue"
import { useDebounceFn } from "@vueuse/core"
const adjustLineEL = ref<HTMLElement>()
const adjustLineEL = ref<HTMLElement>()
//
type Direction = "left" | "right" | "top" | "bottom"
//
type Direction = "left" | "right" | "top" | "bottom"
// Props
interface AdjustLineProps {
// Props
interface AdjustLineProps {
/**
* 所在方向 'left' | 'right' | 'top' | 'bottom'
*/
@ -40,66 +40,66 @@ interface AdjustLineProps {
maxSize?: number
defaultSize?: number
onChange?: (size: number) => void
}
}
const props = withDefaults(defineProps<AdjustLineProps>(), {
const props = withDefaults(defineProps<AdjustLineProps>(), {
direction: "right",
minSize: 100,
maxSize: 800,
})
})
//
const emit = defineEmits<{
//
const emit = defineEmits<{
(e: "resize", size: number): void
(e: "resizeStart"): void
(e: "resizeEnd", size: number): void
}>()
let curTarget: HTMLElement | undefined | null
const isDragging = ref(false)
const currentSize = ref(props.defaultSize || 0)
// 使computed
const isHorizontal = computed(() => props.direction === "left" || props.direction === "right")
// // 使computed
// const cursorStyle = computed(() => (isHorizontal.value ? "ew-resize" : "ns-resize"))
// // localStorage
// const storageKey = computed(() => `adjust-line-${props.mid}`)
// function saveSize(size: number) {
// if (props.mid) {
// try {
// localStorage.setItem(storageKey.value, String(size))
// } catch (error) {
// console.warn("Failed to save size to localStorage:", error)
// }
// }
// }
// function loadSavedSize(): number | null {
// if (props.mid) {
// try {
// const saved = localStorage.getItem(storageKey.value)
// return saved ? Number(saved) : null
// } catch (error) {
// console.warn("Failed to load size from localStorage:", error)
// return null
// }
// }
// return null
// }
// 使resize
const emitResize = useDebounceFn((size: number) => {
}>()
let curTarget: HTMLElement | undefined | null
const isDragging = ref(false)
const currentSize = ref(props.defaultSize || 0)
// 使computed
const isHorizontal = computed(() => props.direction === "left" || props.direction === "right")
// // 使computed
// const cursorStyle = computed(() => (isHorizontal.value ? "ew-resize" : "ns-resize"))
// // localStorage
// const storageKey = computed(() => `adjust-line-${props.mid}`)
// function saveSize(size: number) {
// if (props.mid) {
// try {
// localStorage.setItem(storageKey.value, String(size))
// } catch (error) {
// console.warn("Failed to save size to localStorage:", error)
// }
// }
// }
// function loadSavedSize(): number | null {
// if (props.mid) {
// try {
// const saved = localStorage.getItem(storageKey.value)
// return saved ? Number(saved) : null
// } catch (error) {
// console.warn("Failed to load size from localStorage:", error)
// return null
// }
// }
// return null
// }
// 使resize
const emitResize = useDebounceFn((size: number) => {
emit("resize", size)
}, 16)
}, 16)
// 使ResizeObserver
let observer: ResizeObserver | null = null
const observeResize = () => {
// 使ResizeObserver
let observer: ResizeObserver | null = null
const observeResize = () => {
if (!adjustLineEL.value) return
observer = new ResizeObserver(() => {
@ -111,13 +111,13 @@ const observeResize = () => {
})
observer.observe(adjustLineEL.value)
}
}
onBeforeUnmount(() => {
onBeforeUnmount(() => {
observer && observer.disconnect()
})
})
onMounted(async () => {
onMounted(async () => {
await nextTick()
if (!props.target) {
curTarget = adjustLineEL.value?.parentElement
@ -137,9 +137,9 @@ onMounted(async () => {
},
)
observeResize()
})
})
function handle(target: HTMLElement) {
function handle(target: HTMLElement) {
if (!adjustLineEL.value) return
const nextContainer = target
const el = adjustLineEL.value
@ -316,49 +316,49 @@ function handle(target: HTMLElement) {
}
}
}
}
}
// function handleDrag(e: MouseEvent, target: HTMLElement) {
// const startPos = isHorizontal.value ? e.clientX : e.clientY
// const startSize = isHorizontal.value ? target.clientWidth : target.clientHeight
// function handleDrag(e: MouseEvent, target: HTMLElement) {
// const startPos = isHorizontal.value ? e.clientX : e.clientY
// const startSize = isHorizontal.value ? target.clientWidth : target.clientHeight
// const handleMouseMove = (e: MouseEvent) => {
// const currentPos = isHorizontal.value ? e.clientX : e.clientY
// const diff = props.direction === "right" || props.direction === "bottom" ? startPos - currentPos : currentPos - startPos
// const handleMouseMove = (e: MouseEvent) => {
// const currentPos = isHorizontal.value ? e.clientX : e.clientY
// const diff = props.direction === "right" || props.direction === "bottom" ? startPos - currentPos : currentPos - startPos
// let newSize = startSize - diff
// let newSize = startSize - diff
// //
// newSize = Math.max(props.minSize, Math.min(props.maxSize, newSize))
// //
// newSize = Math.max(props.minSize, Math.min(props.maxSize, newSize))
// //
// if (isHorizontal.value) {
// target.style.width = `${newSize}px`
// } else {
// target.style.height = `${newSize}px`
// }
// //
// if (isHorizontal.value) {
// target.style.width = `${newSize}px`
// } else {
// target.style.height = `${newSize}px`
// }
// currentSize.value = newSize
// emit("resize", newSize)
// }
// currentSize.value = newSize
// emit("resize", newSize)
// }
// const handleMouseUp = () => {
// document.removeEventListener("mousemove", handleMouseMove)
// document.removeEventListener("mouseup", handleMouseUp)
// document.body.style.userSelect = ""
// isDragging.value = false
// saveSize(currentSize.value)
// emit("resizeEnd", currentSize.value)
// }
// const handleMouseUp = () => {
// document.removeEventListener("mousemove", handleMouseMove)
// document.removeEventListener("mouseup", handleMouseUp)
// document.body.style.userSelect = ""
// isDragging.value = false
// saveSize(currentSize.value)
// emit("resizeEnd", currentSize.value)
// }
// document.addEventListener("mousemove", handleMouseMove)
// document.addEventListener("mouseup", handleMouseUp)
// document.body.style.userSelect = "none"
// isDragging.value = true
// emit("resizeStart")
// }
// document.addEventListener("mousemove", handleMouseMove)
// document.addEventListener("mouseup", handleMouseUp)
// document.body.style.userSelect = "none"
// isDragging.value = true
// emit("resizeStart")
// }
const debug = {
const debug = {
log: (...args: any[]) => {
if (process.env.NODE_ENV === "development") {
console.log("[AdjustLine]", ...args)
@ -367,23 +367,23 @@ const debug = {
error: (...args: any[]) => {
console.error("[AdjustLine]", ...args)
},
}
}
function handleError(error: Error, context: string) {
function handleError(error: Error, context: string) {
debug.error(`Error in ${context}:`, error)
//
}
}
//
onErrorCaptured((err, instance, info) => {
//
onErrorCaptured((err, instance, info) => {
handleError(err as Error, info)
console.log(instance);
console.log(instance)
return false
})
})
</script>
<style lang="scss" scoped>
.adjust-line {
.adjust-line {
position: absolute;
z-index: 999;
@ -511,5 +511,5 @@ onErrorCaptured((err, instance, info) => {
background-color: #666;
}
}
}
}
</style>

75
src/renderer/src/components/CodeEditor/code-editor.vue

@ -1,13 +1,13 @@
<script lang="ts" setup>
import { judgeFile } from "./utils"
import { monaco } from "./monaco"
import { computed, getCurrentScope, onBeforeUnmount, onMounted, onScopeDispose, ref, watch } from "vue"
import DefaultLogo from "./120x120.png"
import { PlaceholderContentWidget } from "./PlaceholderContentWidget"
const editorRef = ref<HTMLDivElement>()
let editor: monaco.editor.IStandaloneCodeEditor | null = null
let placeholderWidget: PlaceholderContentWidget | null = null
const props = withDefaults(
import { judgeFile } from "./utils"
import { monaco } from "./monaco"
import { computed, getCurrentScope, onBeforeUnmount, onMounted, onScopeDispose, ref, watch } from "vue"
import DefaultLogo from "./120x120.png"
import { PlaceholderContentWidget } from "./PlaceholderContentWidget"
const editorRef = ref<HTMLDivElement>()
let editor: monaco.editor.IStandaloneCodeEditor | null = null
let placeholderWidget: PlaceholderContentWidget | null = null
const props = withDefaults(
defineProps<{
modelValue?: string
name?: string
@ -24,13 +24,13 @@ const props = withDefaults(
modelValue: "",
name: "",
},
)
const emit = defineEmits<{
)
const emit = defineEmits<{
(e: "update:modelValue", code: string): void
(e: "change", code: string): void
(e: "cursor:position", position: [number, number]): void
}>()
defineExpose({
}>()
defineExpose({
scrollTop() {
editor?.setScrollTop(0)
},
@ -82,10 +82,10 @@ defineExpose({
editor.setValue(content)
}
},
})
})
let isInnerChange = false
function updateModel(name: string, content: string) {
let isInnerChange = false
function updateModel(name: string, content: string) {
if (editor) {
const oldModel = editor.getModel() //
const file = judgeFile(name)
@ -105,14 +105,14 @@ function updateModel(name: string, content: string) {
}
editor.setModel(model)
}
}
function resizeLayout() {
}
function resizeLayout() {
if (editor) {
editor.layout()
}
}
}
onMounted(() => {
onMounted(() => {
if (editorRef.value && !editor) {
editor = monaco.editor.create(editorRef.value, {
theme: "vs-light",
@ -185,14 +185,13 @@ onMounted(() => {
}
},
)
})
if (import.meta.hot) {
import.meta.hot.accept((newModule) => {
console.log(newModule);
})
}
onBeforeUnmount(() => {
if (import.meta.hot) {
import.meta.hot.accept(newModule => {
console.log(newModule)
})
}
onBeforeUnmount(() => {
if (editorRef.value) {
editorRef.value.removeEventListener("resize", resizeLayout)
}
@ -204,8 +203,8 @@ onBeforeUnmount(() => {
editor.dispose()
editor = null
}
})
const style = computed(() => {
})
const style = computed(() => {
if (props.logo && props.logoType === "bg") {
return {
backgroundImage: `url(${props.logo})`,
@ -215,14 +214,14 @@ const style = computed(() => {
}
}
return {}
})
})
const getLogo = computed(() => {
const getLogo = computed(() => {
if (props.logo) return props.logo
return DefaultLogo
})
})
function useResizeObserver(callback: ResizeObserverCallback) {
function useResizeObserver(callback: ResizeObserverCallback) {
const isSupported = window && "ResizeObserver" in window
let observer: ResizeObserver | undefined
const cleanup = () => {
@ -256,12 +255,12 @@ function useResizeObserver(callback: ResizeObserverCallback) {
tryOnScopeDispose(() => {
stop()
})
}
useResizeObserver(() => {
}
useResizeObserver(() => {
if (editor) {
editor.layout()
}
})
})
</script>
<template>
@ -274,7 +273,7 @@ useResizeObserver(() => {
</template>
<style lang="scss" scoped>
.monaco-wrapper {
.monaco-wrapper {
height: 100%;
position: relative;
@ -296,5 +295,5 @@ useResizeObserver(() => {
@apply absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2;
}
}
}
}
</style>

42
src/renderer/src/components/NavBar.vue

@ -39,33 +39,33 @@
</template>
<script setup lang="ts">
import icon from "@res/icon.png"
import config from "config"
import { PopupMenu } from "@/bridge/PopupMenu"
import { usePlatForm } from "common/usePlatform"
import icon from "@res/icon.png"
import config from "config"
import { PopupMenu } from "@/bridge/PopupMenu"
import { usePlatForm } from "common/usePlatform"
const { PlatForm } = usePlatForm()
const { PlatForm } = usePlatForm()
const router = useRouter()
const route = useRoute()
const isFullScreen = ref(false)
const router = useRouter()
const route = useRoute()
const isFullScreen = ref(false)
onBeforeMount(async () => {
onBeforeMount(async () => {
isFullScreen.value = await PlatForm.isFullScreen()
})
})
const isHome = computed(() => {
const isHome = computed(() => {
if (route.fullPath === "/") {
return true
}
return false
})
})
function back() {
function back() {
router.push("/")
}
const { t } = useI18n()
const onClickMenu = e => {
}
const { t } = useI18n()
const onClickMenu = e => {
const menu = new PopupMenu([
{
label: isFullScreen.value ? t("qu-xiao-quan-ping") : t("quan-ping"),
@ -83,20 +83,20 @@ const onClickMenu = e => {
])
const obj = e.target.getBoundingClientRect()
menu.show({ x: ~~obj.x, y: ~~(obj.y + obj.height) })
}
}
const onClickAbout = () => {
const onClickAbout = () => {
PlatForm.showAbout()
}
}
</script>
<style lang="scss" scoped>
.list {
.list {
@apply: flex gap="5px";
-webkit-app-region: no-drag;
.item {
@apply: text-sm px-2 hover:rounded-md hover:bg-gray-2 hover:cursor-pointer text="hover:hover";
}
}
}
</style>

4
src/renderer/src/components/Versions.vue

@ -1,7 +1,7 @@
<script setup lang="ts">
import { reactive } from "vue"
import { reactive } from "vue"
const versions = reactive({ ...window.electron.process.versions })
const versions = reactive({ ...window.electron.process.versions })
</script>
<template>

6
src/renderer/src/layouts/default.vue

@ -1,5 +1,5 @@
<script lang="ts" setup>
import Simplebar from "simplebar-vue"
import Simplebar from "simplebar-vue"
</script>
<template>
@ -9,7 +9,7 @@ import Simplebar from "simplebar-vue"
</template>
<style scoped>
:deep(.simplebar-content) {
:deep(.simplebar-content) {
height: 100%;
}
}
</style>

4
src/renderer/src/pages/_ui/App.vue

@ -1,8 +1,8 @@
<script setup lang="ts">
defineOptions({
defineOptions({
title: "观山",
bg: "ty",
})
})
</script>
<template>

232
src/renderer/src/pages/_ui/Browser.vue

@ -1,46 +1,46 @@
<script setup lang="ts">
import { onBeforeMount, onBeforeUnmount, onMounted, ref, useTemplateRef, nextTick } from "vue"
import { PopupMenu } from "@/bridge/PopupMenu"
import { onBeforeMount, onBeforeUnmount, onMounted, ref, useTemplateRef, nextTick } from "vue"
import { PopupMenu } from "@/bridge/PopupMenu"
defineOptions({
defineOptions({
title: "浏览器",
index: 2,
bg: "bg",
})
// const PlaceHolderRef = useTemplateRef("PlaceHolder")
// function OnResize() {
// const el = PlaceHolderRef.value
// if (el) {
// const rect = el.getBoundingClientRect().toJSON()
// console.log(rect)
// api.call("TabsCommand.bindElement", rect)
// }
// }
// onMounted(OnResize)
// window.addEventListener("resize", OnResize)
// onBeforeUnmount(() => {
// window.removeEventListener("resize", OnResize)
// })
const PlaceHolder = useTemplateRef("PlaceHolder")
const { stop } = useResizeObserver(PlaceHolder, () => {
})
// const PlaceHolderRef = useTemplateRef("PlaceHolder")
// function OnResize() {
// const el = PlaceHolderRef.value
// if (el) {
// const rect = el.getBoundingClientRect().toJSON()
// console.log(rect)
// api.call("TabsCommand.bindElement", rect)
// }
// }
// onMounted(OnResize)
// window.addEventListener("resize", OnResize)
// onBeforeUnmount(() => {
// window.removeEventListener("resize", OnResize)
// })
const PlaceHolder = useTemplateRef("PlaceHolder")
const { stop } = useResizeObserver(PlaceHolder, () => {
const el = PlaceHolder.value
if (el) {
const rect = el.getBoundingClientRect().toJSON()
api.call("TabsCommand.bindElement", rect)
}
})
})
onBeforeUnmount(() => {
onBeforeUnmount(() => {
stop()
api.call("TabsCommand.closeAll")
})
})
const list = ref<any[]>([])
const curUrl = ref<any>("")
const curIndex = ref<any>(-1)
const listener = (_, v) => {
const list = ref<any[]>([])
const curUrl = ref<any>("")
const curIndex = ref<any>(-1)
const listener = (_, v) => {
list.value = v
const el = v.find(v => v.isActive)
curIndex.value = v.findIndex(v => v.isActive)
@ -49,32 +49,32 @@ const listener = (_, v) => {
} else {
curUrl.value = ""
}
}
if (import.meta.hot) {
}
if (import.meta.hot) {
api.off("main:TabsCommand.update", listener)
}
api.on("main:TabsCommand.update", listener)
onMounted(() => {
}
api.on("main:TabsCommand.update", listener)
onMounted(() => {
api.call("TabsCommand.sync")
})
})
onBeforeMount(async () => {
onBeforeMount(async () => {
list.value = await fetch("api://fuck/TabsService/getAllTabs").then(async res => await res.json())
})
})
// const url = ref("")
// const url = ref("")
// async function addTab() {
// if (!url.value) url.value = "about:blank"
// await fetch("api://fuck/TabsService/add", {
// method: "POST",
// body: JSON.stringify({ url: url.value }),
// })
// url.value = ""
// onClick()
// }
// async function addTab() {
// if (!url.value) url.value = "about:blank"
// await fetch("api://fuck/TabsService/add", {
// method: "POST",
// body: JSON.stringify({ url: url.value }),
// })
// url.value = ""
// onClick()
// }
function handleTabContextMenu(_, index) {
function handleTabContextMenu(_, index) {
const menu = new PopupMenu([
{
label: "右侧关闭",
@ -95,9 +95,9 @@ function handleTabContextMenu(_, index) {
},
])
menu.show()
}
}
function scrollTabIntoView(index: number) {
function scrollTabIntoView(index: number) {
nextTick(() => {
const tabList = document.querySelector(".tab-list")
const tabItems = tabList?.querySelectorAll(".tab-item")
@ -105,14 +105,14 @@ function scrollTabIntoView(index: number) {
tabItems[index].scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" })
}
})
}
}
async function changeTab(_, index) {
async function changeTab(_, index) {
await api.call("TabsCommand.setActive", index)
scrollTabIntoView(index)
}
}
function addTabInput() {
function addTabInput() {
if (curUrl.value) {
if (curIndex.value !== undefined && curIndex.value >= 0) {
api.call("TabsCommand.nagivate", curIndex.value, curUrl.value)
@ -120,22 +120,22 @@ function addTabInput() {
api.call("TabsCommand.add", curUrl.value)
}
}
}
}
async function addTab() {
async function addTab() {
await api.call("TabsCommand.add", "about:blank")
scrollTabIntoView(list.value.length - 1)
}
}
async function closeTab(_, index) {
async function closeTab(_, index) {
await fetch("api://fuck/TabsService/closeTab", {
method: "POST",
body: JSON.stringify({ active: index }),
})
onClick()
}
}
const onClick = async () => {
const onClick = async () => {
list.value = await api.call("TabsCommand.getAllTabs")
// list.value = await fetch("api://fuck/TabsService/getAllTabs").then(async res => await res.json())
// fetch("api://fuck/BasicService/showAbout").then(async res => console.log(await res.json()))
@ -143,11 +143,11 @@ const onClick = async () => {
// method: "POST",
// body: JSON.stringify({ a: "234" }),
// }).then(async res => console.log(await res.json()))
}
}
function onClickDevTool() {
function onClickDevTool() {
fetch("api://fuck/BasicService/openTabDevtool")
}
}
</script>
<template>
@ -213,15 +213,15 @@ function onClickDevTool() {
</template>
<style scoped>
.tab-container {
.tab-container {
background: var(--tab-bar-bg, #f3f3f3);
border-bottom: none;
padding-top: 4px;
height: auto;
min-height: 80px;
}
}
.tab-list-container {
.tab-list-container {
position: relative;
display: flex;
align-items: flex-end;
@ -230,9 +230,9 @@ function onClickDevTool() {
margin-bottom: 0;
width: 100%;
overflow: auto;
}
}
.tab-list {
.tab-list {
height: 32px;
display: flex;
align-items: flex-end;
@ -247,9 +247,9 @@ function onClickDevTool() {
&::-webkit-scrollbar {
display: none; /* Chrome, Safari and Opera */
}
}
}
.tab-item {
.tab-item {
position: relative;
min-width: 160px;
max-width: 240px;
@ -263,9 +263,9 @@ function onClickDevTool() {
align-items: center;
flex-shrink: 0; /* 防止标签被压缩 */
cursor: pointer;
}
}
.tab-item::after {
.tab-item::after {
content: "";
position: absolute;
right: 0;
@ -274,20 +274,20 @@ function onClickDevTool() {
width: 1px;
background: var(--tab-separator-color, #bdc1c6);
opacity: 0.3;
}
}
.tab-item:hover {
.tab-item:hover {
background: var(--tab-hover-bg, #e9ebee);
}
}
.tab-item.active {
.tab-item.active {
background: var(--tab-active-bg, #fff);
z-index: 2;
height: 32px;
margin-bottom: -1px;
}
}
.tab-item.active::before {
.tab-item.active::before {
content: "";
position: absolute;
left: 0;
@ -296,34 +296,34 @@ function onClickDevTool() {
height: 2px;
background: var(--primary-color, #1a73e8);
border-radius: 2px 2px 0 0;
}
}
.tab-content {
.tab-content {
display: flex;
align-items: center;
padding: 0 8px;
height: 100%;
gap: 6px;
width: 100%;
}
}
.tab-icon {
.tab-icon {
width: 16px;
height: 16px;
flex-shrink: 0;
border-radius: 3px;
}
}
.tab-icon-placeholder {
.tab-icon-placeholder {
width: 16px;
height: 16px;
background: #bdc1c6;
border-radius: 50%;
flex-shrink: 0;
opacity: 0.7;
}
}
.tab-title {
.tab-title {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
@ -332,13 +332,13 @@ function onClickDevTool() {
color: var(--text-color, #5f6368);
line-height: 1.2;
padding-right: 4px;
}
}
.tab-item.active .tab-title {
.tab-item.active .tab-title {
color: var(--active-text-color, #202124);
}
}
.tab-close {
.tab-close {
width: 16px;
height: 16px;
display: flex;
@ -349,27 +349,27 @@ function onClickDevTool() {
opacity: 0;
transition: opacity 0.15s ease;
flex-shrink: 0;
}
}
.tab-item:hover .tab-close {
.tab-item:hover .tab-close {
opacity: 0.6;
}
}
.tab-close:hover {
.tab-close:hover {
background: var(--close-hover-bg, rgba(0, 0, 0, 0.08));
opacity: 1;
}
}
.new-tab-button-container {
.new-tab-button-container {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 32px;
background: var(--tab-bar-bg);
}
}
.new-tab-button {
.new-tab-button {
width: 32px;
height: 32px;
display: flex;
@ -381,14 +381,14 @@ function onClickDevTool() {
cursor: pointer;
opacity: 0.8;
background: transparent;
}
}
.new-tab-button:hover {
.new-tab-button:hover {
background: var(--tab-hover-bg, rgba(0, 0, 0, 0.06));
opacity: 1;
}
}
.address-bar {
.address-bar {
padding: 8px 12px;
margin: 0;
background: var(--address-bar-bg, #fff);
@ -397,9 +397,9 @@ function onClickDevTool() {
gap: 8px;
width: 100%;
border-top: 1px solid var(--tab-separator-color, rgba(0, 0, 0, 0.1));
}
}
.url-input-container {
.url-input-container {
flex: 1;
height: 36px;
background: var(--input-bg, #f1f3f4);
@ -409,9 +409,9 @@ function onClickDevTool() {
align-items: center;
margin: 0;
min-width: 0;
}
}
.url-input {
.url-input {
width: 100%;
height: 100%;
border: none;
@ -419,9 +419,9 @@ function onClickDevTool() {
outline: none;
font-size: 14px;
color: var(--text-color, #333);
}
}
.action-button {
.action-button {
flex-shrink: 0;
height: 36px;
padding: 0 16px;
@ -432,14 +432,14 @@ function onClickDevTool() {
font-size: 14px;
cursor: pointer;
transition: all 0.2s;
}
}
.action-button:hover {
.action-button:hover {
background: var(--button-hover-bg, #f1f3f4);
}
}
/* 修改CSS变量 */
:root {
/* 修改CSS变量 */
:root {
--tab-bar-bg: #f1f3f4;
--tab-bg: rgba(32, 33, 36, 0.1);
--tab-hover-bg: rgba(32, 33, 36, 0.08);
@ -451,9 +451,9 @@ function onClickDevTool() {
--close-hover-bg: rgba(0, 0, 0, 0.08);
--primary-color: #1a73e8;
--new-tab-shadow: 0 -8px 12px -6px rgba(0, 0, 0, 0.1);
}
}
[data-theme="dark"] {
[data-theme="dark"] {
--tab-bar-bg: #202124;
--tab-bg: rgba(255, 255, 255, 0.1);
--tab-hover-bg: rgba(255, 255, 255, 0.08);
@ -465,5 +465,5 @@ function onClickDevTool() {
--close-hover-bg: rgba(255, 255, 255, 0.08);
--primary-color: #8ab4f8;
--new-tab-shadow: 0 -8px 12px -6px rgba(0, 0, 0, 0.3);
}
}
</style>

46
src/renderer/src/pages/about/index.vue

@ -1,33 +1,33 @@
<script setup lang="ts">
definePage({
definePage({
name: "about",
meta: {
title: "听雨",
bg: "gs",
},
})
})
// const activeTab = ref(0)
// const TopMenu = computed<any[]>(() => {
// return [
// { key: 0, title: "sada", url: "/setting" },
// { key: 1, title: "sdas", url: "/setting/editor" },
// { key: 2, title: "asdas", url: "/setting/update" },
// ]
// })
// const route = useRoute()
// watch(
// () => route,
// route => {
// for (let i = 0; i < TopMenu.value.length; i++) {
// const element = TopMenu.value[i]
// if (route.path.startsWith(element.url)) {
// activeTab.value = element.key
// }
// }
// },
// { immediate: true },
// )
// const activeTab = ref(0)
// const TopMenu = computed<any[]>(() => {
// return [
// { key: 0, title: "sada", url: "/setting" },
// { key: 1, title: "sdas", url: "/setting/editor" },
// { key: 2, title: "asdas", url: "/setting/update" },
// ]
// })
// const route = useRoute()
// watch(
// () => route,
// route => {
// for (let i = 0; i < TopMenu.value.length; i++) {
// const element = TopMenu.value[i]
// if (route.path.startsWith(element.url)) {
// activeTab.value = element.key
// }
// }
// },
// { immediate: true },
// )
</script>
<template>
<div>

86
src/renderer/src/pages/browser.vue

@ -1,10 +1,10 @@
<script setup lang="ts">
import Simplebar from "simplebar-vue"
import { getAssetsFile } from "@/utils"
import Simplebar from "simplebar-vue"
import { getAssetsFile } from "@/utils"
const allModules: Record<string, any> = import.meta.glob("./_ui/**/*.vue", { eager: true })
let allApp: any[] = []
Object.keys(allModules).forEach(key => {
const allModules: Record<string, any> = import.meta.glob("./_ui/**/*.vue", { eager: true })
let allApp: any[] = []
Object.keys(allModules).forEach(key => {
// let [, p] = key.match("./_ui/(.*?).vue")!
// p = p.replace(/\.vue$/, "")
const m = allModules[key]?.default || allModules[key]
@ -14,47 +14,47 @@ Object.keys(allModules).forEach(key => {
_sort: m.index ?? 0,
comp: m,
})
})
allApp = allApp.sort((a, b) => (a.index - b.index <= 0 ? 1 : -1))
})
allApp = allApp.sort((a, b) => (a.index - b.index <= 0 ? 1 : -1))
const active = ref(0)
// const allApp = [
// { label: "", comp: defineAsyncComponent(() => import("./_ui/Browser.vue")) },
// { label: "", bg: "gs", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", bg: "ty", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "访", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// ]
const active = ref(0)
// const allApp = [
// { label: "", comp: defineAsyncComponent(() => import("./_ui/Browser.vue")) },
// { label: "", bg: "gs", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", bg: "ty", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "访", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// { label: "", comp: defineAsyncComponent(() => import("./_ui/App.vue")) },
// ]
const activeBg = computed(() => {
const activeBg = computed(() => {
if (active.value === undefined) return ""
const value = allApp[active.value]?.bg
return value ? getAssetsFile(`@/assets/images/home/${value}.png`) : ""
})
})
function onClick(index: number) {
function onClick(index: number) {
active.value = index
}
}
</script>
<template>
@ -90,7 +90,7 @@ function onClick(index: number) {
</template>
<style lang="scss" scoped>
.content {
.content {
.bg {
position: absolute;
left: 0;
@ -105,8 +105,8 @@ function onClick(index: number) {
// blur(4px)
filter: brightness(1);
}
}
.item {
}
.item {
position: relative;
&::before {
content: "";
@ -139,5 +139,5 @@ function onClick(index: number) {
.text {
transition-duration: 300ms;
}
}
}
</style>

8
src/renderer/src/pages/index.vue

@ -1,14 +1,14 @@
<script setup lang="ts">
definePage({
definePage({
meta: {
home: true,
},
})
})
const state = reactive({
const state = reactive({
content: "",
name: "aaa.ts",
})
})
</script>
<template>

1
src/types/global.d.ts

@ -1,4 +1,3 @@
type Api = {
call: (command: string, ...args: any[]) => Promise<any>
callLong: (command: string, ...args: any[]) => Promise<any>

4
推荐.md

@ -1,15 +1,11 @@
插件化:
https://rubickcenter.github.io/docs/core/index.html#%E5%9F%BA%E4%BA%8E-browserview-%E5%AE%9E%E7%8E%B0%E6%8F%92%E4%BB%B6%E5%8C%96%E8%83%BD%E5%8A%9B
electron+vue虚拟桌面开发遇坑之透明窗口鼠标穿透
https://blog.csdn.net/weixin_42421494/article/details/102800491
截图
https://zhuanlan.zhihu.com/p/46043613?from_voters_page=true

Loading…
Cancel
Save