diff --git a/src/hello.svelte b/src/hello.svelte index 4854e91..b619b3f 100644 --- a/src/hello.svelte +++ b/src/hello.svelte @@ -8,7 +8,6 @@ import { showMessage } from "siyuan"; export let name: string; export let i18n: any; - export let opendCount: number; let time; let ver; @@ -17,14 +16,6 @@ time = new Date(); }, 1000); - let intv2 = setInterval(async () => { - ver = await version(); - showMessage( - `[${opendCount}] Hello ${name} v${ver}`, - 5000 - ); - }, 10000); - onMount(async () => { time = new Date(); ver = await version(); @@ -36,7 +27,6 @@ onDestroy(() => { showMessage("Hello panel closed"); clearInterval(intv1); - clearInterval(intv2); }); $: time_str = new Date(time).toLocaleTimeString(); @@ -46,7 +36,7 @@
-

[{opendCount}] Hello {name} v{ver}

+

Hello {name} v{ver}

{time_str} diff --git a/src/index.ts b/src/index.ts index 9b085f3..067536d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,21 +33,22 @@ export default class SamplePlugin extends Plugin { } }); + let div = document.createElement("div"); + new HelloExample({ + target: div, + props: { + name: this.i18n.name, + i18n: this.i18n.hello + } + }); this.customTab = this.addTab({ type: TAB_TYPE, init() { - this.tab = new HelloExample({ - target: this.element, - props: { - name: this.i18n.name, - opendCount: this.counter.hello, - i18n: this.i18n.hello - } - }); + this.element.appendChild(div); + console.log(this.element); }, destroy() { console.log("destroy tab:", TAB_TYPE); - this.tab.$destroy(); //Call svelte component destroy } }); @@ -192,7 +193,6 @@ export default class SamplePlugin extends Plugin { target: dialog.element.querySelector("#helloPanel"), props: { name: this.i18n.name, - opendCount: this.counter.hello, i18n: this.i18n.hello } });