-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ed2495
commit 2e61f6a
Showing
19 changed files
with
255 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script setup lang="ts"> | ||
import type { PageInfo } from '@uni-helper/devtools-types' | ||
import { VueButton, VueDropdown, VueInput } from '@vue/devtools-ui' | ||
const props = defineProps<{ | ||
page: PageInfo | ||
}>() | ||
const params = ref('') | ||
function navigate() { | ||
const url = `/${props.page.path}` | ||
// @ts-expect-error uni在webview的js-sdk中有getEnv方法 | ||
uni.getEnv(({ h5 }) => { | ||
if (h5) { | ||
trpc.changeCurrentPage.mutate({ | ||
isTabBar: Boolean(props.page.tabBar), | ||
page: params.value ? `${url}?${params.value}` : url, | ||
}) | ||
} | ||
else { | ||
const path = props.page.path | ||
uni[props.page.tabBar ? 'switchTab' : 'redirectTo']({ | ||
url: params.value ? `${path}?${params.value}` : path, | ||
}) | ||
} | ||
}) | ||
} | ||
</script> | ||
|
||
<template> | ||
<VueDropdown> | ||
<code cursor-pointer> | ||
<span> | ||
{{ `/${page.path}` }} | ||
</span> | ||
</code> | ||
<template #popper="{ hide }"> | ||
<div p2> | ||
<form flex="~ col" @submit.prevent="() => { navigate(); hide() }"> | ||
<div px2 text-sm op50> | ||
Fill params and navigate: | ||
</div> | ||
<div flex="~" items-center p2 text-sm font-mono> | ||
{{ `/${page.path}?` }} | ||
<VueInput | ||
v-model="params" | ||
n-sm w-20 | ||
placeholder="params" | ||
/> | ||
</div> | ||
<VueButton block type="primary"> | ||
Navigate | ||
</VueButton> | ||
</form> | ||
</div> | ||
</template> | ||
</VueDropdown> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<script setup lang="ts"> | ||
import type { PageMeta } from '@uni-helper/devtools-types' | ||
import { VueBadge } from '@vue/devtools-ui' | ||
defineProps<{ | ||
routeInput: string | ||
}>() | ||
const pages = await trpc.getPages.query() | ||
function metaToString(meta: PageMeta, num: number = 0) { | ||
const metaStr = JSON.stringify(meta, null, num) | ||
return metaStr === '{}' ? '-' : metaStr | ||
} | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<table w-full> | ||
<thead border="b base" px-3> | ||
<tr> | ||
<th text-left /> | ||
<th text-left> | ||
Page Path | ||
</th> | ||
<th text-left> | ||
Page Meta | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr v-for="page of pages" :key="page.path" class="group" h-7 border="b dashed transparent hover:base"> | ||
<td w-20 pr-1> | ||
<div flex items-center justify-end> | ||
<VueBadge | ||
v-if="page.tabBar" | ||
bg-green-400:10 text-green-400 | ||
> | ||
tabBar | ||
</VueBadge> | ||
</div> | ||
</td> | ||
<td text-sm> | ||
<div flex="inline gap3" items-center> | ||
<PagePathItem | ||
:page="page" | ||
:class="page.path.includes(routeInput) && routeInput !== '' ? 'text-green-400' : ''" | ||
/> | ||
<div op0 group-hover:op100 flex="~ gap1"> | ||
<button | ||
text-sm op40 hover="op100 text-primary-400" | ||
title="Open in editor" | ||
@click="openInEditor(page.filePath)" | ||
> | ||
<div i-carbon-script-reference /> | ||
</button> | ||
</div> | ||
</div> | ||
</td> | ||
<td w-80 ws-nowrap pr-1 text-left text-sm font-mono op50 hover="text-primary op100"> | ||
<span inline-block w-80 cursor-pointer overflow-hidden text-ellipsis :title="metaToString(page.meta, 2)" @click="() => $emit('selectMeta', page.meta)">{{ metaToString(page.meta) }}</span> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script setup lang="ts"> | ||
import type { PageMeta } from '@uni-helper/devtools-types' | ||
import { VueCodeBlock } from '@vue/devtools-ui' | ||
defineProps<{ | ||
meta: PageMeta | ||
}>() | ||
defineEmits<{ | ||
close: [] | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<div p-2> | ||
<div class="flex items-center justify-between"> | ||
<span class="font-500">Page meta detail</span> | ||
<div class="i-carbon-close cursor-pointer p1 $ui-text" @click="$emit('close')" /> | ||
</div> | ||
<VueCodeBlock :code="JSON.stringify(meta, null, 2)" lang="json" lines /> | ||
</div> | ||
</template> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.