Skip to content

Commit

Permalink
Merge pull request #2 from chenweiyi/master
Browse files Browse the repository at this point in the history
feat: support template search
feat: add auto refresh feature
  • Loading branch information
zcf0508 authored Sep 6, 2023
2 parents 43ecf96 + ed5453d commit 0e0f5b6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions packages/playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@
>
|
</div>
<div class="flex-1 flex flex-col">
<div>
<button @click="start">
<div ref="chartRef" class="flex-1 flex flex-col">
<div class="flex mt-16px">
<button class="mr-8px" @click="start">
analyze
</button>
<span>
<input id="refreshBtn" v-model="autoRefresh" type="checkbox" />
<label for="refreshBtn">Auto Refresh</label>
</span>
</div>
<div class="h-full w-full relative">
<div v-if="showSearchInput" class="absolute right-[10px] top-0 z-50">
Expand Down Expand Up @@ -121,11 +125,13 @@ import CodeMirror from './components/codemirror/CodeMirror.vue';
import { defaultCode } from './default-code';
const code = ref(defaultCode);
const autoRefresh = ref(false);
provide('autoresize', true);
function codeChange(value: string) {
code.value = value;
autoRefresh.value && start();
}
const networkRef = ref<HTMLElement>();
Expand Down Expand Up @@ -193,7 +199,11 @@ async function start() {
const showSearchInput = ref(false);
const searchInputRef = ref<HTMLInputElement>();
const chartRef = ref<HTMLInputElement>();
const { isOutside } = useMouseInElement(chartRef);
onKeyStroke(['F', 'f', 'Command', 'Ctrl'], (e) => {
if (isOutside.value) return;
e.preventDefault();
showSearchInput.value = true;
nextTick(() => {
Expand Down Expand Up @@ -244,4 +254,8 @@ html, body, #__nuxt {
height: 100vh;
overflow: hidden;
}
:root {
--bg: #fff;
}
</style>

0 comments on commit 0e0f5b6

Please sign in to comment.